显示UINavigationBar(Show UINavigationBar)

系统教程 行业动态 更新时间:2024-06-14 16:57:18
显示UINavigationBar(Show UINavigationBar)

这是交易...我无法让UINavigation栏显示在我的一个观点上。 我在IB中的NavigationViewController中完成了所有操作并通过IB转向导航栏,因为我不想在我的大多数应用程序中使用它,但是当我尝试通过代码显示导航栏时,它不显示。

这是我用来尝试让导航栏显示的代码......但是没有用:

[self.navigationController setNavigationBarHidden:NO animated:YES]; [self.navigationController setNavigationBarHidden:NO]; self.navigationController.navigationBarHidden = NO; self.navigationController.navigationBar.hidden = NO;

任何帮助将不胜感激

恭敬地,马特

Here's the deal... I can't get the UINavigation bar to appear on one of my views. I have the whole thing in a NavigationViewController in IB and turned of the navigation bar though IB because I don't want it in most of my app but when I try to show the navigation bar via code, it doesn't show up.

here's the code I used to try to get the nav bar to show up... but didn't work:

[self.navigationController setNavigationBarHidden:NO animated:YES]; [self.navigationController setNavigationBarHidden:NO]; self.navigationController.navigationBarHidden = NO; self.navigationController.navigationBar.hidden = NO;

Any help will be greatly appreciated

respectfully, Matt

最满意答案

您编写的代码只能在UINavigationController的一个控制器内部工作,而不能在视图中工作。

因此,如果从视图中调用它,则应将self替换为放置此视图的控制器名称。

The code you write should only work inside of one of UINavigationController's controllers, not views.

So, if you call it from your view, you should replace self with controller name,in which this view is placed.

更多推荐

本文发布于:2023-04-12 20:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/b6eed2b8b10dc6d93bf91ffba7df2e06.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:UINavigationBar   Show

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!