4thSpace
4thSpace

Reputation: 44352

NavigationController not pushing view

I'm accessing a navigation controller from the app delegate and trying to push another view:

[appDelegate.myNavigationController pushViewController:self.detailView animated:YES];

but nothing is happening. The above is in myTableView.

The app is tabbar based. I added a NavigationController object under the TabbarController object in IB. Then I created a reference to myNavigationController in the app delegate.

Any suggestions how I can figure out why the above code isn't working? It works if addSubview to the current view.

Upvotes: 0

Views: 1535

Answers (2)

Paul Lynch
Paul Lynch

Reputation: 19789

This may not be an answer to your question.

Your code looks confusing. Is the snippet from a UITableView subclass or from a UITableViewController subclass? What makes me ask is that your argument for pushViewController: is self.detailView. Keeping the distinction clear is extremely important.

If the code is being called from a view controller that shows a navigation bar, then you should be using self.navigationController rather than adding a property to appDelegate.

In particular, you need to be using the navigation controller in your tab.

Any of these could cause a problem with the view not appearing.

Upvotes: 0

Ed Marty
Ed Marty

Reputation: 39700

Make sure that appDelegate is not null (wherever you're getting it from is returning the right value), appDelegate.myNavigationController is not null (the IBOutlet was setup properly), and that appDelegate.myNavigationController.window is not null (it is currently displayed on the top of the stack.

Also make sure that any animations of previous pushing or popping of views are complete before you push your new item.

Upvotes: 1

Related Questions