iPhone SDK:使用导航栏打开 TableViewController

发布于 2024-10-09 22:08:02 字数 514 浏览 0 评论 0原文

我现在正在创建我的第一个 iPhone 应用程序,尽管我遇到了一些障碍,但它进展顺利。我正在尝试打开我的设置视图(UITableViewController),尽管导航栏不会显示...我已成功打开视图,只是无法显示导航栏。这是我的代码:

- (void)viewDidLoad {
[super viewDidLoad];

[self.navigationController setNavigationBarHidden:NO];
self.title = @"Settings";

UIBarButtonItem *saveItem = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStyleDone target:self action:nil];
self.navigationItem.rightBarButtonItem = saveItem;

[saveItem release];

}

如果我做错了什么,请告诉我。

I'm creating my first iPhone app at the moment and it's going great, though I've come to a bump in the road. I'm trying to open up my settings view (a UITableViewController), though the navigation bar won't show up... I've successfully made the view open, just can't get the navigation bar to show up. Here's my code:

- (void)viewDidLoad {
[super viewDidLoad];

[self.navigationController setNavigationBarHidden:NO];
self.title = @"Settings";

UIBarButtonItem *saveItem = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStyleDone target:self action:nil];
self.navigationItem.rightBarButtonItem = saveItem;

[saveItem release];

}

If I'm doing something wrong, tell me.

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

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

发布评论

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

评论(1

零度° 2024-10-16 22:08:02

您必须将导航控制器作为子视图添加到主视图中。

例如,

[window addSubview:NavigationController.view]

You have to add the navigation controller as a sub view to the main view.

for example,

[window addSubview:NavigationController.view]

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