//为导航栏添加右侧按钮(系统自带删除)
// self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(selectMore:)];
// 设置为图片
self.navigationItem.rightBarButtonItem = [[UIBarButtonItemalloc] initWithTitle:nilstyle:UIBarButtonItemStylePlaintarget:selfaction:@selector(selectMore:)];
[self.navigationItem.rightBarButtonItemsetImage:[UIImageimageNamed:@"sytb"]];
//设置为文字
// self.navigationItem.rightBarButtonItem =[[UIBarButtonItem alloc]initWithTitle:@"文字" style:UIBarButtonItemStylePlain target:self action:@selector(selectText:)];
//
self.navigationItem.rightBarButtonItem.tintColor=[UIColorwhiteColor];
#pragma mark - 选中右边的item
-(void)selectMore:(id)paramSender{
NSLog(@" 点击了更多按钮 ");
}
//左侧加入自定义按钮
LocationBtn *btn=[[LocationBtn alloc]init];
[btn setImage:[UIImage imageNamed:@"下拉"] forState:UIControlStateNormal];
[btn setTitle:city forState:UIControlStateNormal];
[btn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
[btn sizeToFit];
[btn addTarget:self action:@selector(ClickScanCode:) forControlEvents: UIControlEventTouchUpInside];
UIBarButtonItem *leftItemBtn = [[UIBarButtonItem alloc] initWithCustomView:btn];
self.navigationItem.leftBarButtonItem=leftItemBtn;