一,工程图。
二,代码。
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]; }