I'm having a problem with my navigation controller. If I add a view controller to the stack:
- (void) tui_ToggleListStudy:(id)sender
{
listVC = [[ListViewController alloc] init];
[self.navigationController pushViewController:listVC animated:NO];
[listVC release];
}
I have NSLog messages for the view controller beneath, for both viewWillDisappear:
and viewDidDisappear
- but only viewWillDisappear:
is getting called.
Not only that, but the view controller doesn't receive any other delegate messages either: No viewDidUnload
, or dealloc
...
Is there anything I can do about this?
I'm stumped! Any thoughts?
Thanks!
Assuming your navigation controller is contained in some kind of top view controller, you must also forward the relevant messages from that top view controller to the nav controller:
You must call super at implementation of viewWillDisappear.
I know the answer if you made the same typo in your code that you made in your question: the method signature is
viewDidDisappear:
(with theanimated
argument), notviewDidDisappear
.A view controller will not be deallocated when you push another controller onto the stack. And
viewDidUnload
won't be called unless you run out of memory.The designated initializer for UIViewController is
-initWithNibName:bundle:
. Are you sure your view controller is finding its nib and finds its connected view? I'll bet if you set a breakpoint after init'ing your ListViewController, you'll find its -view returns nil.