标签:
/*下面是UINavigationBar*/
//创建一个导航栏
//如果碰到是UINavigationController要添加一个按钮的话
UINavigationController *nav;
UIToolbar * aToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, [UIScreen mainScreen].applicationFrame.size.height-44, 320, 44)];
aToolbar.tintColor = [UIColor blackColor];
[self.view addSubview:aToolbar];
//返回
UIBarButtonItem * backItem = [[UIBarButtonItem alloc] initWithTitle:@"返回"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(backUpPage:)];
backItem.tintColor = [UIColor grayColor];
//标题
UIBarButtonItem * titleItem = [[UIBarButtonItem alloc] initWithTitle:@"选择城市"
style:UIBarButtonItemStylePlain
target:nil
action:nil];
//确定按钮
UIBarButtonItem * confirmItem = [[UIBarButtonItem alloc] initWithTitle:@"确定"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(confirmSelectCity:)];
confirmItem.tintColor=[UIColor grayColor];
//站位Item
UIBarButtonItem * spaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
aToolbar.items = [NSArray arrayWithObjects:backItem, spaceItem, titleItem, spaceItem,confirmItem, nil];
UINavigationBar和UIToolbar设置title和按钮
标签:
原文地址:http://www.cnblogs.com/huangzs/p/4472116.html