1

How to get reference to UIViewControllers baseview . I tried this

UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];

UIView *  baseView = keyWindow.rootViewController.view;

but in the baseView variable I am getting UILayoutContainerView instead of the view inside the UIViewController .Correct me if I am wrong somewhere .

user3115014
  • 667
  • 1
  • 8
  • 23

1 Answers1

2

Use AppDelegate's instance to get UIWindow and then from it the rootViewController like this:

UIViewController *viewController = yourObjAppDelegate.window.rootViewController;

UIView *baseView = viewController.view;

NSLog(@"%@ : %@",viewController,baseView);
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132