IOS 移除栈顶的控制器

 

- (IBAction)back2Two:(id)sender {
    // 移除当前栈顶的控制器
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)back2root:(id)sender {
    // 移除除了栈底控制器的所有控制器
    [self.navigationController popToRootViewControllerAnimated:YES];
    
    // 只要传入栈中的某一个控制器,就会跳转到指定控制器
//    NJTwoViewController *two = [[NJTwoViewController  alloc] init];
//    [self.navigationController popToViewController:two animated:YES];
}

 

posted on 2017-03-08 16:46  守望星空  阅读(186)  评论(0编辑  收藏  举报

导航