Is it possible to get last shown view controller in AppDelegate in

- (void)applicationDidBecomeActive:(UIApplication *)application;

Thanks for answering=)

有帮助吗?

解决方案

If your rootViewController is UINavigationController, you can get is topViewController

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

If you have a UITabBarController as rootViewController

 UITabBarController *nav = 
  (UITabBarController *)[[self window] rootViewController];
 [nav.selectedViewController view].backgroundColor = [UIColor redColor];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top