Mason
Mason

Reputation: 7103

UINavigationController back button triggers the current view to disappear early

I have a simple navigation controller in my iPad app, but I'm getting a weird bug that I've never seen before. I can push a view onto the view controller stack fine, but when I hit the back button on the navigation bar, the view disappears before sliding off the screen. I don't do anything funky with viewDidDisappear or anything. Has anyone else run into this before?

Upvotes: 0

Views: 189

Answers (1)

David Hoerl
David Hoerl

Reputation: 41642

If I was having this problem, I'd add log messages to viewWillDisappear, viewDidDisappear, and dealloc. I'm assuming you are using ARC but its not all that critical.

In all cases I would NSLog the method name and the view, like:

NSLog(@"viewWillDisappear: view=%@ animated=%d", self.view, animated);

Make sure you call super in the first two methods.

I suspect your view is getting removed from its superview or released before you think it should be.

Upvotes: 1

Related Questions