![](/img/trans.png)
[英]How to hide and show UIViewController button in AppDelegate? - Swift
[英]How to import a UIViewController in AppDelegate using swift
我有一個名為FirstViewController.swift的UIViewController
類,我想在名為MySample的應用程序中的AppDelegate.swift中導入。如何在AppDelegate.swift中導入UIViewController.swift。 我用谷歌搜索,但找不到有效的答案。
提前致謝。
嘗試以下代碼:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String, annotation: AnyObject?) -> Bool {
var rootViewController = self.window!.rootViewController as UINavigationController
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var FirstViewController = mainStoryboard.instantiateViewControllerWithIdentifier("StoryBoardID") as FirstViewController
rootViewController.pushToViewController(FirstViewController, animated: true)
return true
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.