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];
            }
        }
相關文章
相關標籤/搜索