【发布时间】:2011-12-05 16:35:12
【问题描述】:
我想在全局 AppDelegate 中添加一个全局右栏按钮,这样我的所有视图控制器都会自动拥有这个按钮。
我在 AppDelegate 中添加了
navigator.window.rootViewController.navigationController.navigationItem.rightBarButtonItem
= [[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Test", @"")
style:UIBarButtonItemStyleBordered target:self action:@selector(showTest)] autorelease];
上面的代码当然不行。。上面的代码有什么问题吗?
【问题讨论】:
-
而且,据我所知,在 iPhone SDK 的当前状态下无法做到这一点。您需要将该项目添加到您拥有的每个视图控制器中。
标签: iphone objective-c ios xcode three20