IOS开发实现右侧按钮功能的内容

来自:互联网
时间:2023-04-15
阅读:

一,工程图。

IOS开发实现右侧按钮功能的内容

二,代码。

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];
}
返回顶部
顶部