在NavBar中显示UIBarButtonItem的自定义图像(图像被覆盖)

时间:2012-04-04 00:50:15

标签: objective-c ios ios5 uibarbuttonitem navigationcontroller

提前致谢。我无法在导航栏中正确显示自定义按钮。他们最终得到了iOS5“编辑”或“完成”或“后退”按钮。我设置为文本的属性的奇怪部分显示得很好但不是图像。

问题的屏幕抓取:

http://i.stack.imgur.com/DLCPV.png

navController中的代码:

AlarmViewController *alarmController = [[[AlarmViewController alloc] initWithNibName:@"AlarmViewController" bundle:nil] autorelease];
alarmController.title = @"Alarms";

// Set NavBar and TabBar Items
[alarmController.tabBarItem setFinishedSelectedImage:alarmsSelected withFinishedUnselectedImage:alarmsUnselected];
UINavigationController *navAlarmController = [[UINavigationController alloc] initWithRootViewController:alarmController];
UIBarButtonItem *editButton = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStyleBordered target:self action:nil];  
[[navAlarmController navigationItem] setRightBarButtonItem:editButton];

// Setup a navigational controller and push the alarm controller on it
[self.navigationController pushViewController:alarmController animated:YES];
alarmController.delegate = self.delegate;

在目标视图的viewDidLoad中:

self.navigationItem.rightBarButtonItem = self.editButtonItem;

再次感谢。令人沮丧,因为我希望它与主题相匹配,但它不想合作。帮助!

0 个答案:

没有答案