中间按钮
UIButton *btnShow = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 34, 34)];
btnShow.backgroundColor = [UIColor colorWithWhite:0.411 alpha:1.000];
[btnShow setImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateNormal];
[btnShow setImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateHighlighted];
self.navigationItem.titleView = btnShow;
右栏按钮
UIButton *tempButton1 = [UIButton buttonWithType:UIButtonTypeCustom];
[tempButton1 setFrame:CGRectMake(0, 0, 34, 34)];
tempButton1.tag = 0;
[tempButton1 addTarget:self action:@selector(btnBackClicked:) forControlEvents:UIControlEventTouchUpInside];
[tempButton1 setImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateNormal];
[tempButton1 setImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateHighlighted];
[self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithCustomView:tempButton1]];
左栏按钮
UIButton *tempButton = [UIButton buttonWithType:UIButtonTypeCustom];
[tempButton setFrame:CGRectMake(0, 0, 34, 34)];
[tempButton addTarget:self action:@selector(btnBackClicked:) forControlEvents:UIControlEventTouchUpInside];
[tempButton setImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateNormal];
[tempButton setImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateHighlighted];
[self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithCustomView:tempButton]
输出