Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't UINavigationController have a rootViewController property?

I am very curious. We really can't access it easily. I mean, I know it has, but not accessible.

Why?

Basically I want that rootViewController to be loaded before sending some events by accessing it's view. There is an postnotification that's set up on viewDidload.

like image 854
user4951 Avatar asked Apr 11 '13 01:04

user4951


1 Answers

If you have more than one, then use:

UIViewController *root = navController.viewControllers[0];

where navController is you UINavigationController. This will work always.

Use UINavigationController topViewController. This works if there is only one controller.

like image 57
rmaddy Avatar answered Sep 17 '22 15:09

rmaddy