Re: viewWillAppear not called with UINavigationController containment
Re: viewWillAppear not called with UINavigationController containment
- Subject: Re: viewWillAppear not called with UINavigationController containment
- From: Curt Clifton <email@hidden>
- Date: Tue, 27 Dec 2011 10:24:09 -0800
On Dec 27, 2011, at 5:51 AM, Roland King wrote:
> // 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
That looks about like what we're doing successfully. The only difference I see is that we're adding/removing views between the paired view controller calls. In the example below, both self and slice are UIViewController subclasses.
// removing
[slice willMoveToParentViewController:nil];
if ([slice isViewLoaded] && slice.view.superview == view)
[slice.view removeFromSuperview];
[slice removeFromParentViewController];
...
// adding
[self addChildViewController:slice];
[view addSubview:slice.view];
[slice didMoveToParentViewController:self];
HTH.
Cheers,
Curt
_______________________________________________
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