Reputation: 697
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 .
Upvotes: 1
Views: 245
Reputation: 38259
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);
Upvotes: 2