我需要根据用户的注册情况设置我的应用的起始视图。 这将在AppDelegate中完成:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if(isUserRegistrated() == true){
let vc : AnyObject! = self.storyboard.instantiateViewControllerWithIdentifier("isRegistrated")
self.showViewController(vc as UIViewController, sender: vc)
}
else{
let vc : AnyObject! = self.storyboard.instantiateViewControllerWithIdentifier("isNOTRegistrated")
self.showViewController(vc as UIViewController, sender: vc)
}
}
此时我收到了错误: " AppDelegate类型的值没有storyboard"
的成员有任何结论吗?
答案 0 :(得分:0)
示例:
let storyboard = UIStoryboard(name: "MyStoryboardName", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("someViewController") as! UIViewController
self.presentViewController(vc, animated: true, completion: nil)