我有问题显示导航栏的rightBarButtonItem - 我试图在应用程序委托中创建它,我的UINavigationController设置。rightBarButtonItem不会出现在导航栏iOS
代码如下:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
RSCListViewController *list = [[RSCListViewController alloc] initWithStyle:UITableViewStylePlain];
self.navController = [[UINavigationController alloc] initWithRootViewController:list];
UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"+"
style:UIBarButtonItemStylePlain
target:list
action:@selector(addPressed:)];
self.navController.navigationItem.rightBarButtonItem = barButton;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
[DatabaseManager openDatabase];
return YES;
}
运行应用程序,没有按钮项目出现在导航栏上。
我不确定我是否漏掉了一些明显的东西 - 我尝试使用相关的堆栈溢出线程纠正问题并没有取得任何成功。
任何帮助表示赞赏。
一切显示正常? – Kyle