开发者

NavigationController not pushing view

开发者 https://www.devze.com 2022-12-31 02:28 出处:网络
I\'m accessing a navigation controller from the app delegate and trying to push another view: [appDelegate.myNavigationController pushViewController:self.detailView animated:YES];

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 creat开发者_如何学Ced 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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消