Вопрос

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