美文网首页
iOS pop到指定页面

iOS pop到指定页面

作者: 空城阿风 | 来源:发表于2017-10-09 11:08 被阅读11次

oc:

for (UIViewController *temp in self.navigationController.viewControllers) {

if ([temp isKindOfClass:[你要跳转到的Controller class]]) {

[self.navigationController popToViewController:temp animated:YES];

}

}

swif:```
let vcIndex = self.navigationController?.viewControllers.indexOf({ (viewController) -> Bool in

        if let _ = viewController as? Personal {
            return true
        }
        return false
    })
    
    let composeVC = self.navigationController?.viewControllers[vcIndex!] as! Personal
    
    self.navigationController?.popToViewController(composeVC, animated: true)

相关文章

网友评论

      本文标题: iOS pop到指定页面

      本文链接:https://www.haomeiwen.com/subject/iuxpextx.html