Thanks in advance. I'm having trouble getting my custom buttons to display properly in my navbar. They just end up with the stock iOS5 "Edit" or "Done" or "Back" buttons over it. The weird part the attributes I set to the text and such are showing up just fine but not the images.
Screen grab of the problem:
http://i.stack.imgur.com/DLCPV.png
Code in the 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;
In viewDidLoad for the target view:
self.navigationItem.rightBarButtonItem = self.editButtonItem;
Thanks again. Frustrating because I want it to match the theme but it doesn't want to cooperate. help!
UIImage *navButton = [[UIImage imageNamed:@"navbar_button_rect.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)]; UIImage *navBackButton = [[UIImage imageNamed:@"navbar_button_point.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 5)]; [[UIBarButtonItem appearance] setBackgroundImage:navButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [[UIBarButtonItem appearance] setBackButtonBackgroundImage:navBackButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];