0

我在导航控制器中添加了两个按钮,一个是右键和左键,我想在右键之前添加第三个按钮。怎么做?

 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;

这就是我在左侧添加一个按钮的方式。

4

1 回答 1

4

iOS 5 帮助您在导航栏上创建超过 2 个条形按钮

self.navigationItem.leftBarButtonItems = [NSArray arrayWithObjects:uibarbuttonInstance1, uibarbuttonInstance2, nil];

右键相同

self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:uibarbuttonInstance1, uibarbuttonInstance2, nil];
于 2012-08-22T11:43:01.183 回答