【问题标题】:Showing/dismissing a walkthrough - iOS Application structure显示/关闭演练 - iOS 应用程序结构
【发布时间】:2015-01-25 09:09:14
【问题描述】:

当应用程序第一次启动时,我需要展示经典的演练,但是根据我想到的实现,我最终得到了一个结构,该结构将演练保持为层次结构的第一个控制器......而且我不喜欢那样。这是我的实现的描述:

1) 在didFinishLaunchingWithOption 中,我检查了 UsereDefault 以赶上第一次启动

2) 如果是第一次发布,我将window 的rootViewController 替换为演练

3) 演练完成后,我会提交first view controller of the App

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

您能否建议一个显示/关闭演练的好模式?

【问题讨论】:

  • 您的应用程序使用导航控制器吗?走过了吗?

标签: ios walkthrough application-structure


【解决方案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 之上将演练显示为模态。

【讨论】:

  • 有没有办法实现平滑过渡?以这种方式更改 rootController 会产生可怕的 gfx 效果。
  • 你需要为此编写一些自定义动画。
【解决方案2】:

看看这个库来实现你的演练https://github.com/ruipfcosta/SwiftyWalkthrough。

【讨论】:

    猜你喜欢
    • 2012-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多