我有点被BWWalkthrough库困住了,我试图在应用程序启动时实现这个库。我有两个故事板,主板和SlidesFlow故事板。我将主界面设置为SlidesFlow,并将初始故事板设置为SlidesFlow。我为BWWalkthroughViewController创建了一个视图,为BWWalkthroughPageViewController创建了另一个视图。在我的AppDelegate中,在didFinishLaunchingWithOptions函数中,我使用了以下代码:
private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// Get view controllers and build the walkthrough
let stb = UIStoryboard(name: "SlidesFlow", bundle: nil)
let walkthrough = stb.instantiateViewController(withIdentifier: "SlideShow") as! BWWalkthroughViewController
let page_zero = stb.instantiateViewController(withIdentifier: "Slide_1")
let page_one = stb.instantiateViewController(withIdentifier: "Slide_2")
let page_two = stb.instantiateViewController(withIdentifier: "Slide_3")
let page_three = stb.instantiateViewController(withIdentifier: "Slide_4")
// 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)
return true
}这不管用吗?我是不是遗漏了什么?
发布于 2016-09-28 10:55:05
发现问题时,似乎根本没有调用didFinishLaunchingWithOptions函数,因为我把我的项目从xcode 7转移到了xcode 8。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool在这方面:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:[UIApplicationLaunchOptionsKey : Any]? = nil) -> Boolhttps://stackoverflow.com/questions/39729998
复制相似问题