【发布时间】:2023-03-20 19:35:02
【问题描述】:
我从 BaseViewController 继承了我的 ViewController,并使用情节提要 ID 推送了我的 SecondViewController。但是,当我尝试从第二个视图弹出视图到视图控制器时,它不起作用。 这是我的代码:
dispatch_async(dispatch_get_main_queue(), ^{
[self showMesssgeonAlert:@"Success"];
[self hideProgress];
[self.navigationController popViewControllerAnimated:TRUE];
});
即使我尝试过:
NSArray *controllerArray = self.navigationController.viewControllers;
for (id controller in controllerArray)
{
if ([controller isKindOfClass:[ViewController class]])
{
[self.navigationController popViewControllerAnimated:TRUE];
}
}
但是,它在这两种情况下都不起作用。我该怎么办?请帮助我。
【问题讨论】:
-
您检查
self.navigationController是否不是nil? -
确保两个视图控制器在同一个
UINavigationController堆栈上?
标签: ios objective-c iphone popviewcontrolleranimated