一,工程图。
二,代码。
ViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//增加右侧按钮
[self addRightButton];
}
#pragma -mark -functions
//增加右侧按钮
-(void)addRightButton
{
UIBarButtonItem *selectButton = [[UIBarButtonItem alloc] initWithTitle:@"筛选" style:UIBarButtonItemStyleDone target:self action:@selector(doClickRightButton)];
self.navigationItem.rightBarButtonItem = selectButton;
}
#pragma -mark -doClickAction
-(void)doClickRightButton
{
FirstViewController *first=[[FirstViewController alloc]init];
[self.navigationController pushViewController:first animated:NO];
}