我正在嘗試爲我的應用程序創建一個演練(介紹)。我正在使用BWWalkthrough來做到這一點。如果想在點擊一個按鈕後打開這個視圖控制器,它會起作用(正如你可以在下面的代碼中看到的那樣)。但我不想這樣做。我想在啓動屏幕加載後打開此視圖控制器。LaunchScreen加載後顯示ViewController
當我點擊主視圖的「初始視圖控制器」,並在viewDidLoad方法中添加了下面的代碼時,我只能看到母版頁,但看不到視圖控制器(page_one,page_two ...)頁。可能我必須在AppDelegate中編寫一些代碼,但我不知道它怎麼樣
我該如何解決這個問題?
@IBAction func testButton(_ sender: Any) {
let goStoryboard = UIStoryboard(name: "Main", bundle: nil)
let walkthrough = goStoryboard.instantiateViewController(withIdentifier: "master") as! BWWalkthroughViewController
let page_one = goStoryboard.instantiateViewController(withIdentifier: "page1") as UIViewController
let page_two = goStoryboard.instantiateViewController(withIdentifier: "page2")as UIViewController
let page_three = goStoryboard.instantiateViewController(withIdentifier: "page3")as UIViewController
**// Attach the pages to the master**
walkthrough.delegate = self
walkthrough.add(viewController:page_one)
walkthrough.add(viewController:page_two)
walkthrough.add(viewController:page_three)
self.present(walkthrough, animated: true, completion: nil)
}
我之前已經實現了這個..但它在OBJ-C ..還是想看看嗎? –