用Pop方式切换ViewController

第一个ViewController中的按钮方法:

  SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]];
    //设置第二个窗口中的delegate为第一个窗口的self
    secondView.delegate = self;
   
    [self.navigationController pushViewController:secondView animated:YES];

第二个ViewController中的按钮方法:
  [self.navigationController popViewControllerAnimated:YES];


评论

此博客中的热门博文

使__attribute__((annotate("xxx")))能作用于OC函数

viewWillAppear不执行的解决办法

iOS中使用xpc/xpc.h