ios跳到根控制器(swift 附跳到指定控制器的连接)self.navigationController.viewControllers UINavigationController

1.跳到根控制器

let nav:UINavigationController = sliderVC.rightVC as! UINavigationController;
        nav.popToRootViewController(animated: false);

2.跳到指定控制器

    let story = UIStoryboard.init(name: "Main", bundle: nil)
    let VC:searchVC = story.instantiateViewController(withIdentifier: "searchVC") as! searchVC;
    var arrM = NSMutableArray(array: self.navigationController?.viewControllers ?? []);
    arrM.removeLastObject();
    arrM.add(VC);
    self.navigationController?.setViewControllers(arrM as! [UIViewController], animated: true);

参考博客:
链接: iOS - 跳转到指定的控制器

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页