Linking UINavigationController in Storyboard to AppDelegate

只谈情不闲聊 提交于 2019-12-11 11:19:12

问题


So I started an iOS app with the single view template. I then added a navigation controller by dragging it into the storyboard. How do I references this from my app delegate? I tried ctrl-dragging it into my AppDelegate outlet-style but that obviously doesn't work. What do I do? Instantiate one and then assign it as rootview controller?

By the end of this I'd like to use the AppDelegate to set the view to the top of the navigation controller. Thanks!


回答1:


In IB you should select the navigation controller and then click the "Is Initial View Controller" check box in the inspector -- this automatically makes that controller the root view controller of the window. In your app delegate, you can get a reference to the navigation controller with self.window.rootViewController and assign it to a property if you want.



来源:https://stackoverflow.com/questions/11979705/linking-uinavigationcontroller-in-storyboard-to-appdelegate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!