如何使用 Xcode 制作首次启动 iPhone 应用指南
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13335540/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make first launch iPhone App tour guide with Xcode
提问by Ashoor
I'd like to know how to make a first launch tour guide for my iOS App with Xcode, I describe myself as a beginner in ObjectiveC language but what I know logically is that I've to make the App to detect the first launch of the Application and then display a scrollable tour guide with a skip button on the top to dismiss.
我想知道如何使用 Xcode 为我的 iOS 应用程序制作首次启动指南,我将自己描述为 ObjectiveC 语言的初学者,但我从逻辑上知道我必须让应用程序检测到应用程序,然后显示一个可滚动的导游,顶部有一个跳过按钮以关闭。
I've searched though the website but didn't find the best solution for my question.
我已经搜索了该网站,但没有找到我的问题的最佳解决方案。
It's basically two question:
基本上是两个问题:
"How to detect the first launch of the app?" How to detect first time app launch on an iPhone
"How to display the the tour guide which probably will be located in the storyboard?"
“如何检测应用程序的首次启动?” 如何检测首次在 iPhone 上启动的应用程序
“如何显示可能位于故事板中的导游?”
What I want is similar to the tour guide in (Paper) iPad app in Appstore.
我想要的类似于Appstore中(Paper)iPad应用程序中的导游。
回答by Rob
On your first question, there is an accepted answerto the link you provided that answers your question. I'm not at all sure what your question is, as you seem to have found the answer on your own.
On your second question, you should define a segue from your main view to the first scene of your tour guide and then trigger a segue programmaticallyon the basis of the results of the above answer. Bottom line, you have a segue between your main scene to the first scene of your tour guide, give that segue a unique identifier, and then on the basis of the
NSUserDefaults
stuff referenced in the previous point, invokingperformSegueWithIdentifier
if you determine that it's appropriate to kick off your tour.By the way, you're probably used to creating segues connected to a button or something like that. In this case, though, you'll create a segue between the view controllers by control-dragging (or right-click-dragging) from the view controller icon in the first scene to the first scene, like below. That way, it's not a scene that is triggered by a button or something like that, but something that, once you specify the identifier for the segue, your
viewDidLoad
of the first view controller can invoke the segue programmatically viaperformSegueWithIdentifier
:
关于您的第一个问题,您提供的用于回答问题的链接有一个可接受的答案。我完全不确定您的问题是什么,因为您似乎自己找到了答案。
关于你的第二个问题,你应该定义一个从你的主视图到你的导游的第一个场景的segue,然后根据上述答案的结果以编程方式触发segue。最重要的是,您在主场景和导游的第一个场景之间有一个转场,给该转场一个唯一的标识符,然后根据
NSUserDefaults
上一点中引用的内容,调用performSegueWithIdentifier
是否适合踢离开你的旅行。顺便说一下,您可能习惯于创建连接到按钮或类似东西的转场。但是,在这种情况下,您将通过控制拖动(或右键单击拖动)从第一个场景中的视图控制器图标到第一个场景,在视图控制器之间创建一个 segue,如下所示。这样,它不是由按钮或类似的东西触发的场景,而是一旦您为 segue 指定标识符,您
viewDidLoad
的第一个视图控制器就可以通过以下方式以编程方式调用 segueperformSegueWithIdentifier
:
If you have any questions, let us know.
如果您有任何问题,请告诉我们。