iOS4中的App代理和View Controller [英] App delegate and View Controller in iOS4
本文介绍了iOS4中的App代理和View Controller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- (void)applicationDidFinishLaunching:(UIApplication *)application {
//
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
- (void)applicationWillEnterForeground:(UIApplication *)应用程序{
[viewController.view reloadInputViews];
}
任何人都可以帮助我强制视图控制器执行/刷新它已经显示?
解决方案
您可以明确调用viewWillAppear,例如
- (void)applicationWillEnterForeground:(UIApplication *)application {
[viewController.view reloadInputViews];
[viewController viewWillAppear];
}
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)applicationDidFinishLaunching:(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];
}
这篇关于iOS4中的App代理和View Controller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文