我在导航控制器中添加了两个按钮,一个在右键和左键的位置,我想在右键之前添加第三个按钮。怎么做?
UIButton *logo_btn = [UIButton buttonWithType:UIButtonTypeCustom];
[logo_btn setBackgroundImage:[UIImage imageNamed:@"logo-57.png"] forState:UIControlStateNormal];
[logo_btn setFrame:CGRectMake(-2, 0, 47, 47)];
UIBarButtonItem *btnItem1 = [[UIBarButtonItem alloc] initWithCustomView:logo_btn];
self.navigationItem.leftBarButtonItem = btnItem1;
这就是我在左边添加一个按钮的方法。
答案 0 :(得分:4)
iOS 5可帮助您在导航栏上创建2个以上的条形按钮
self.navigationItem.leftBarButtonItems = [NSArray arrayWithObjects:uibarbuttonInstance1, uibarbuttonInstance2, nil];
右键按钮
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:uibarbuttonInstance1, uibarbuttonInstance2, nil];