viewWillAppear not called with UINavigationController containment
viewWillAppear not called with UINavigationController containment
- Subject: viewWillAppear not called with UINavigationController containment
- From: Roland King <email@hidden>
- Date: Tue, 27 Dec 2011 21:51:55 +0800
Wrote my first UINavigationController container yesterday, appeared to work just fine. It's a particularly dumb one which displays the views from two contained UIViewControllers side by side. I'm using it to show on one page what on my iPhone app shows on two pages, by putting the two VCs together side by side.
Running it, viewWillAppear: is not called on either of the two contained VCs. viewDidAppear is called, viewWillDisappear: is called, viewDidDisappear: is called, but never viewWillAppear: .. well except if I make the transition a popover (as opposed to a modal or push), in that case it is called, but that's not the transition I want.
I've checked that I'm calling addChildViewController: and didMoveToParentViewController:, and even changed the code to make sure all those calls are made before the view is even requested let alone added, here's the code from that class, appearingViewControllers in this case is all of them and disappearingViewControllers is empty
// tell each of the controllers we're adding that they are being added and prepare the ones being removed for removal
for( UIViewController *controller in appearingControllers )
[ self addChildViewController:controller ];
[ disappearingControllers makeObjectsPerformSelector:@selector( willMoveToParentViewController: ) withObject:nil ];
[ appearingControllers makeObjectsPerformSelector:@selector( didMoveToParentViewController: ) withObject:self ];
[ disappearingControllers makeObjectsPerformSelector:@selector( removeFromParentViewController ) ];
// get the views in order
NSArray *newViews = [ viewControllers valueForKey:@"view" ];
// views then added to our view
Made no difference, still not called (except if the transition is a popover). The views are added properly, they show, but viewWillAppear: is never called on the contained view controllers. When those VCs are used alone in the iPhone app I get all 4 calls in the order expected.
I've hunted the dev forums, read the documentation to see if there's something missed, and googled, with no joy. Does this ring a bell with anyone?
Thanks
Roland_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden