最后显示视图控制器

时间:2014-03-12 21:04:26

标签: ios objective-c uiviewcontroller appdelegate

是否可以在

中的AppDelegate中显示最后一个显示的视图控制器
- (void)applicationDidBecomeActive:(UIApplication *)application;

感谢您回答=)

1 个答案:

答案 0 :(得分:2)

如果您的rootViewControllerUINavigationController,则可以获得topViewController

 UINavigationController *nav = 
  (UINavigationController *)[[self window] rootViewController];
 [nav.topViewController view].backgroundColor = [UIColor redColor];

如果UITabBarControllerrootViewController

 UITabBarController *nav = 
  (UITabBarController *)[[self window] rootViewController];
 [nav.selectedViewController view].backgroundColor = [UIColor redColor];