2016-09-27 6 views
0

Ich bin ein wenig mit der BWWalkthrough-Bibliothek fest, die ich beim Start der Anwendung zu implementieren versuchen. Ich habe zwei Storyboards, das Storyboard Main und SlidesFlow. Ich stelle die Hauptschnittstelle auf SlidesFlow und setze das anfängliche Storyboard als SlidesFlow. Ich habe 1 Ansicht für BWWalkthroughViewController und eine andere 4 für BWWalkthroughPageViewController erstellt. In meinem AppDelegate in der didFinishLaunchingWithOptions Funktion habe ich den folgenden Code:Machen Sie BWWalkthrough Bibliothek starten beim Start

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 
} 

Sollte diese Arbeit nicht? Fehle ich etwas?

+2

Weisen Sie die 'window.rootViewController = walkthrough' vor dem' Rückkehr true' –

+0

Es funktioniert immer noch nicht. – Netra

+0

Überprüfen Sie, ob der gesamte viewContoller initialisiert wurde oder ob Walkthrough nicht gleich Null ist. –

Antwort

0

Gefunden das Problem, es scheint, dass didFinishLaunchingWithOptions Funktion überhaupt nicht aufgerufen wurde, denke ich, weil ich mein Projekt von Xcode 7 nach xcode 8 übertragen. Wenn also jemand mit einem ähnlichen Problem kämpft, ersetzen Sie einfach die alte Funktion DidFinishLaunchingWithOptions

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 

mit diesem:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:[UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool 
+0

bro @ NETRA, könnten Sie bitte ein Blick auf mein Problem https://StackOverflow.com/Questions/45004255/How-to-Add-Label-in-BwwalkThrough-view-Controller-with-Swift-3? –

Verwandte Themen