IOS界面推界面如何回到root界面

来源:互联网 发布:福利彩票预测软件 编辑:程序博客网 时间:2024/05/17 06:39

IOS界面推界面一般push和present

例如A->B->C   那C回到A该怎么办呢?C直接调用下面的方法就可以回到A



present推界面的方法

-(void)dismissModalStack {

    UIViewController *vc =self.presentingViewController;    

    while (vc.presentingViewController) {

           // while (![vc isKindOfClass:[PersonContentViewController class]]){  //dismiss到指定的界面

        vc = vc.presentingViewController;        

    }

    [vc dismissViewControllerAnimated:YES completion:NULL];

}


push推界面的方法

- (void)popToRootModalStack

{

    [self.navigationController popToRootViewControllerAnimated:YES];

}



原创粉丝点击