用Pop方式切换ViewController
第一个ViewController中的按钮方法:
SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:[NSBundle mainBundle]];
//设置第二个窗口中的delegate为第一个窗口的self
secondView.delegate = self;
[self.navigationController pushViewController:secondView animated:YES];
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];
评论
发表评论