如何使用swift在AppDelegate中导入UIViewController

时间:2015-01-14 08:23:37

标签: ios iphone swift uiviewcontroller

我有一个名为FirstViewController.swift的UIViewController类,我想在AppDelegate.swift中导入我的app,命名为MySample.How,以便在AppDelegate.swift中导入UIViewController.swift。我用Google搜索但无法找到有效的答案。

提前致谢。

1 个答案:

答案 0 :(得分:0)

试用此代码:

    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

  }