开发者

App delegate and View Controller in iOS4

With multi-tasking in iOS4, the home button puts the app into background and when it comes back into foreground I want the View Controller to 'refresh' (and hence viewWillAppear to be called). I put this in the app delegate thought this should work but nothing happens

 - (void)ap开发者_Python百科plicationDidFinishLaunching:(UIApplication *)application {    

    //  
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];
 }


 - (void)applicationWillEnterForeground:(UIApplication *)application {
    [viewController.view reloadInputViews];
 }

Can anyone help me with forcing a view controller to 'execute'/refresh when it is already showing?


You could call viewWillAppear explicitly e.g.

- (void)applicationWillEnterForeground:(UIApplication *)application {
    [viewController.view reloadInputViews];

    [viewController viewWillAppear];
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜