导航栏隐藏

发布于 2024-12-28 10:14:38 字数 292 浏览 2 评论 0原文

我的导航栏有问题。它没有显示在应有的位置,并且在 Xcode 界面生成器中的“模拟指标”下,“顶部栏”属性设置为“黑色导航栏”。在我的代码中,我还将隐藏属性设置为 false,因此这不应该成为问题。

我的底部确实有一个 UITabBar,但是,它也包含在“模拟指标”类别中。

请参阅:http://postimage.org/image/jv4lremwl/full/

I'm having issues with my navigation bar. It isn't showing up where it should, and under "Simulated Metrics" in the Xcode interface builder the "Top Bar" property is set to "Black Navigation Bar". In my code, I also have the hidden property set to false, so that shouldn't be of issue.

I do have a UITabBar at the bottom, however, that is also accounted for in the "Simulated Metrics" category.

See: http://postimage.org/image/jv4lremwl/full/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不奢求什么 2025-01-04 10:14:38

“模拟指标”正如其名称所示:“模拟表示”,与您在代码(或 XCode 界面构建器)中创建(或未创建)的任何对象无关。如果您设置模拟 NavigationBar 为黑色或模拟指标中的任何颜色,这对您的实际项目没有任何意义,因为它只是您实际实现时如何显示的视觉参考(

如果您想要一个“真实的项目”) 。 “导航顶栏你必须实现 UINavigationController,或手动添加 UINavigationBar(通过代码或视觉方式)。

The "Simulated Metrics is as it's name indicates: a "simulated representation" that is not connected with any Object that you will have created (or not) in your code (or in the XCode interface builder). If you set the simulated NavigationBar to black or whatever color in the simulated metrics, that means nothing to your actual project because it is only a visual reference of how it will be displayed if you actually implement it.

If you want to have a "real" navigation top bar you have to implement a UINavigationController, or add manually a UINavigationBar (through code or visually).

岁月静好 2025-01-04 10:14:38

集成选项卡栏控制器和导航栏控制器的最简单方法是使用代码创建它们。 (这是我最常用的)

//Creating the navigation bar
//rVC is some root view controller you have on your code

UINavigationController *nav1 = [[UINavigationController alloc] init];
    [nav1 pushViewController:rVC animated:YES];
    nav1.navigationBar.barStyle = UIBarStyleBlack;
[rVC release];

//Creating the tab bar custom image and title
UITabBarItem *tab1 = [[UITabBarItem alloc] initWithTitle:@"Nav1" image:[UIImage imageNamed:@"nav1Image.png"] tag:1];
    [nav1 setTabBarItem:tab1];

//making the navigation bar visible in the inside tab bar
UITabBarController *tabController = [[UITabBarController alloc] init];
tabController.viewControllers = [NSArray arrayWithObjects:nav1, nil];

希望对你有帮助。
干杯

The simplest way to integrate Tab bar Contrller and Navigation bar controller is by creating them with code. ( That is what i use mostly )

//Creating the navigation bar
//rVC is some root view controller you have on your code

UINavigationController *nav1 = [[UINavigationController alloc] init];
    [nav1 pushViewController:rVC animated:YES];
    nav1.navigationBar.barStyle = UIBarStyleBlack;
[rVC release];

//Creating the tab bar custom image and title
UITabBarItem *tab1 = [[UITabBarItem alloc] initWithTitle:@"Nav1" image:[UIImage imageNamed:@"nav1Image.png"] tag:1];
    [nav1 setTabBarItem:tab1];

//making the navigation bar visible in the inside tab bar
UITabBarController *tabController = [[UITabBarController alloc] init];
tabController.viewControllers = [NSArray arrayWithObjects:nav1, nil];

Hope it is helpful for you.
Cheers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文