如何在iOS 7中使用Swift设置rootViewController

我想在应用程序委托中设置rootViewController ..

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

var rootView: MyRootViewController = MyRootViewController()

//Code to set this viewController as the root view??

return true

}

回答:

你可以做这样的事情。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

var rootView: MyRootViewController = MyRootViewController()

if let window = self.window{

window.rootViewController = rootView

}

return true

}

以上是 如何在iOS 7中使用Swift设置rootViewController 的全部内容, 来源链接: utcz.com/qa/417754.html

回到顶部