【发布时间】:2015-12-18 10:14:25
【问题描述】:
我有一个流程如下的应用程序:
主情节提要:导航 A -> ViewController A1(我的应用程序的第一个屏幕)...转到某些屏幕并转到其他情节提要。
第二个故事板:导航 B -> ViewController B1 -> ViewController B2 -> ViewController B3。
我在B3时的正常逻辑,点击返回按钮回到B2并再次点击返回B1 ...
现在我想通过单击返回按钮从 B3 转到 A1。我使用此代码
UIStoryboard *Main = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *theTabBar = (UIViewController *)[Main instantiateViewControllerWithIdentifier:@"PageController"];
[self.navigationController pushViewController:theTabBar animated:YES];
但它没有按我的意愿工作(在 Main 上出现了后退按钮,这是错误的),我将 pushViewController 更改为 popViewController 但它也不起作用。
【问题讨论】:
-
您正在寻找 UnwindSegue raywenderlich.com/113394/storyboards-tutorial-in-ios-9-part-2
-
不要做这样的事情,它会让你的最终用户感到困惑,如果导航不可预测,你也可能会冒着通过审核程序失败的风险。
-
从第二个故事板中移除导航 B 并直接从第一个导航控制器推送视图控制器 B1。
-
@holex 谢谢你,但我没有选择,这是我客户的理想选择。
标签: ios objective-c iphone back