我是swift和xcode的新手,我想知道是否有人可以帮助我解决我面临的一个问题……如何让情节提要自动加载,而不是按下按钮启动?
这里有一个很好的例子:https://github.com/ariok/BWWalkthrough
在这个例子中,以及在网上找到的其他例子中,总是有一个按钮需要按下,但在我正在开发的应用程序中,我希望自动加载第一个屏幕,并有一个跳过/继续按钮。
这是按钮的代码:
@IBAction func playWalkthrough() {
// Get view controllers and build the walkthrough
let stb = UIStoryboard(name: "Walkthrough", bundle: nil)
let walkthrough = stb.instantiateViewControllerWithIdentifier("walk") as! BWWalkthroughViewController
let page_zero = stb.instantiateViewControllerWithIdentifier("walk0") as! UIViewController
let page_one = stb.instantiateViewControllerWithIdentifier("walk1") as! UIViewController
let page_two = stb.instantiateViewControllerWithIdentifier("walk2")as! UIViewController
let page_three = stb.instantiateViewControllerWithIdentifier("walk3") as! UIViewController
// Attach the pages to the master
walkthrough.delegate = self
walkthrough.addViewController(page_one)
walkthrough.addViewController(page_two)
walkthrough.addViewController(page_three)
walkthrough.addViewController(page_zero)
self.presentViewController(walkthrough, animated: true, completion: nil)
}


干杯,罗伯
发布于 2015-09-08 08:54:34
单击故事板中的viewController,转到属性检查器并将is Initial View Controller设置为true。
https://stackoverflow.com/questions/32447596
复制相似问题