提前致谢。我无法让我的自定义按钮在我的导航栏中正确显示。他们最终只是在上面显示了 iOS5 的“编辑”或“完成”或“返回”按钮。我为文本设置的属性的奇怪部分显示得很好,但图像却没有。
问题截图:
http://i.stack.imgur.com/DLCPV.png
导航控制器中的代码:
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;
再次感谢。令人沮丧,因为我希望它与主题相匹配,但它不想合作。帮助!