显示/解除演练 - iOS应用程序结构

时间:2015-01-25 09:09:14

标签: ios walkthrough application-structure

我需要在第一次启动应用程序时提供经典演练,但是,考虑到我的实现,我最终得到了一个结构,将演练作为层次结构的第一个控制器...而且我不喜欢那样。以下是我的实施说明:

1)didFinishLaunchingWithOption我检查UsereDefault以抓住首次发布

2)如果是第一次启动,我将rootViewController的{​​{1}}替换为演练

3)演练结束后,我将展示window

问题在于 3 点。从演练中呈现控制器我最终将整个应用程序作为演练的模态演示...我想要的是用标准的第一个视图控制器完全替换演练。

你能否建议一个好的模式来展示/解散演练?

2 个答案:

答案 0 :(得分:1)

完成演练后,请替换窗口的rootViewController

FirstViewController *firstVC = [[FirstViewController alloc] init];
yourAppDelegate.window.rootViewController = firstVC;

或者如果您使用的是故事板:

FirstViewController *firstVC = (FirstViewController *)[[UIStoryboard storyboardWithName:@"YourStoryboardName" bundle: nil] instantiateViewControllerWithIdentifier:@"YourFirstVCId"];
yourAppDelegate.window.rootViewController = firstVC;

另一个选项是FirstViewController如果是第一次将演练显示为模态。

答案 1 :(得分:0)

请查看此库以实施演练https://github.com/ruipfcosta/SwiftyWalkthrough