如何删除带有视图的导航控制器
我有一个带有导航栏的选项卡栏应用程序。对于其中一项操作,我以编程方式实例化导航控制器并添加带有表视图的视图。我想通过单击新导航栏上的按钮以编程方式删除此导航栏和表格视图。怎么办?
我尝试了 popview 但它没有弹出。
I have a tabbar application with a navigation bar. For one of the actions I am instantiating a navigation controller programatically and adding a view with tableview. I want to remove this navigation bar and tableview programatically clicking a button on the new navigation bar. how to do this ?
I tried popview but it is not poping out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
隐藏它
如果您在另一个 UIViewController 之上添加了一个 UINavigationController,那么从 uiNaviagation 控制器中,即使您删除当前视图和所有子视图,您也将无法删除导航栏。 (父 uiviewcontroller 也获得导航栏)
解决此问题的一种方法是,访问应用程序委托,并在之前从窗口中删除顶部视图
添加 UINavigationController
然后添加 UINavigationController,当您想用第一个 UiViewController 替换 UINavigationcontroller 时。执行与上面类似的步骤。
To hide it
If you have added a UINavigationController on top of another UIViewController, then from the uiNaviagation controller, you will not be able to remove the navigation bar even if you remove the current view, and all the subview. (the parent uiviewcontroller also get the nav bar)
One way to fix this is, access the app delegate, and remove the top view from the window before
adding the UINavigationController
then add UINavigationController, when you want to replace the UInavigationcontroller with the first UiViewController. do the similar steps like above.