如何在storyboard中使用navigationcontrol

自己搞了个导航栏,要模拟成 navigation controller的样子,需要使用UINavigationbar 单独在view上
self.navigationItem.title = @"A custom title"; [self.navigationBar pushNavigationItem:self.navigationItem animated:NO]; 

The above code that you have a property navigationBar which references the stand-alone navigation bar.

//

UINavigationBars manage a stack of UINavigationItems much like aUINavigationController manager a stack of UIViewControllers. To set what is visible directly, you should use either pushNavigationItem:animated: or setItems:animated: using the navigationItem of the view controller you want the bar to reflect.

这两个全部使用stack方式来操作,以保持一致,所以自己操作也要用pushnavigationitem的方式来设置。

另外一个解决方法:

Simply put your UIViewController into a new UINavigationControllers view controller stack and present that navigation controller modally. 这个比较简单,也就是把原来的view再包装一个UINavigationController。然后再以model方式显示出来。

===》

关于再storyboard中,要在某个子scene中使用UInavigationcontroller,不要自己去修改一个view controller class为uinavigationcontroler似乎不管用。要拖一个Navigation controller进去,然后删除右边出现的tableview


你可能感兴趣的:(Class)