ios 界面间跳转

1.导航控制器UINavigationControllercode

[self.navigationController pushViewController:newC animated:YES]; //跳转到下一页面
[self.navigationController popViewControllerAnimated:YES]; //返回上一页面
[self.navigationController popToRootViewControllerAnimated: YES ];  //返回根控制器,即最开始的页面

2.可是发现如今push不行,因此采用了下面这个方法利用 Modal 形式展现控制器io

[self presentViewController:newC animated:YES completion:^{ 

    }];

2.1返回class

[self dismissViewControllerAnimated:YES completion:^{
        
    }];

3.返回到二级以上的界面object

for (UIViewController *controller in self.navigationController.viewControllers) {
            if ([controller isKindOfClass:[BackViewController class]]) {
                SettingConfigurationSensorViewController *popVC = (BackViewController *)controller;
                [self.navigationController popToViewController:popVC animated:YES];
            } else {
                [self popoverPresentationController];
            }
        }
相关文章
相关标签/搜索