我是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)
}
干杯, 罗布
答案 0 :(得分:0)
单击Storyboard中的viewController,转到属性检查器并将is Initial View Controller
设置为true。