簡體   English   中英

Swift中的Mamaral入門庫

[英]Mamaral onboarding library in Swift

我無法使入職系統正常工作。 我正在使用此框架: https : //github.com/mamaral/Onboard

該框架的演示僅在Objective-C中提供,我已經盡力在Swift中創建自己的版本,並且幾乎完成了,但是在最后一屏之后,我陷入了轉移到另一個故事板的方法中。 這是我目前的代碼:

class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

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


    func setupNormalRootViewController() -> Void {

        self.window?.rootViewController = LoginViewController

    }


    let firstPage = OnboardingContentViewController(title: "Welcome To my App", body: "App Mesage", image: UIImage(named: "heart"), buttonText: "") {}
    let secondPage = OnboardingContentViewController(title: "...", body: "Message", image: UIImage(named: "Mint"), buttonText: "") {}

    let thirdPage = OnboardingContentViewController(title: "title", body: "abcd", image: UIImage(named: "Choco"), buttonText: "End", action: { setupNormalRootViewController() } ) {}

    let onboardingVC = OnboardingViewController(backgroundImage: UIImage(named: "blueBackground"), contents: [firstPage, secondPage,thirdPage])




    self.window?.rootViewController = onboardingVC
 }
}

我在thirdPage變量中調用setupNormalRootViewController ,但是似乎沒有辦法繼續前進,即使我在按下最后一個屏幕上的按鈕時已設置了要運行的指定方法,也無法通過初始入職屏幕。

    class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?



func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.




    let firstPage = OnboardingContentViewController(title: "Welcome To my App", body: "App Mesage", image: UIImage(named: "heart"), buttonText: "") {}
    let secondPage = OnboardingContentViewController(title: "...", body: "Message", image: UIImage(named: "Mint"), buttonText: "") {}

    let thirdPage = OnboardingContentViewController(title: "title", body: "abcd", image: UIImage(named: "Choco"), buttonText: "End") { () -> Void in
        self.setupNormalRootViewController()
    }

    let onboardingVC = OnboardingViewController(backgroundImage: UIImage(named: "blueBackground"), contents: [firstPage, secondPage,thirdPage])


    self.window?.rootViewController = onboardingVC


    return true
}

func setupNormalRootViewController() -> Void {

    self.window?.rootViewController = ViewController()

}
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM