Ios AppDelegate中的开关视图(Swift)
我需要根据用户是否注册设置我的应用程序的起始视图。 这将在AppDelegate中完成:Ios AppDelegate中的开关视图(Swift),ios,swift,view,appdelegate,Ios,Swift,View,Appdelegate,我需要根据用户是否注册设置我的应用程序的起始视图。 这将在AppDelegate中完成: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { if(isUserRegistrated() == true){ let vc : A
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类型的值没有序列图像板的成员”
有什么结论吗 示例:
let storyboard = UIStoryboard(name: "MyStoryboardName", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("someViewController") as! UIViewController
self.presentViewController(vc, animated: true, completion: nil)
示例:
let storyboard = UIStoryboard(name: "MyStoryboardName", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("someViewController") as! UIViewController
self.presentViewController(vc, animated: true, completion: nil)
你注册了你的故事板吗?我如何注册我的故事板?你注册了你的故事板吗?我如何注册我的故事板?当我这样做时,我得到错误:“Instants成员故事板不能用于类型AppDelegate”当我这样做时,我得到错误:“Instants成员故事板不能用于类型AppDelegate”