您的位置:首页 > 其它

自定义导航栏多个按钮

2015-04-10 13:23 357 查看
UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 150, 45)];

[tools setTintColor:[self.navigationController.navigationBar tintColor]];

[tools setAlpha:[self.navigationController.navigationBar alpha]];

NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:2];

UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch

target:self action:@selector(clickSettings:)];

UIBarButtonItem *anotherButton1 = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UITabBarSystemItemContacts

target:self action:@selector(clickEdit:)];

[buttons addObject:anotherButton];

[buttons addObject:anotherButton1];

[tools setItems:buttons animated:NO];

UIBarButtonItem *myBtn = [[UIBarButtonItem alloc] initWithCustomView:tools];

self.navigationItem.rightBarButtonItem = myBtn;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: