【发布时间】:2016-08-22 22:03:29
【问题描述】:
好的,我完全改变了我以前的代码,这是我需要的,但是最后一次推送到导航控制器不起作用
if application.applicationState == UIApplicationState.Background || application.applicationState == UIApplicationState.Inactive {
if let user = userInfo["user"] as? String{
User.loadUserById(user, completion: {result in
let rootViewController = UIApplication.sharedApplication().keyWindow?.rootViewController as! SWRevealViewController
let StoryB = UIStoryboard(name: "Main", bundle: nil)
let Logged : UITabBarController = StoryB.instantiateViewControllerWithIdentifier("TabBarController") as! UITabBarController
rootViewController.setFrontViewPosition(FrontViewPosition.Left, animated: true)
let profileViewController : UserProfileVC = StoryB.instantiateViewControllerWithIdentifier("UserProfileVC") as! UserProfileVC
profileViewController.user = result
rootViewController.pushFrontViewController(Logged, animated: true)
let wc = rootViewController.frontViewController as! UITabBarController
if let wcc = wc.selectedViewController as? UINavigationController{
wcc.pushViewController(profileViewController, animated: true)
}
})
}
}
【问题讨论】:
-
您确定“TabBarController”是您的 TabBarController 的正确标识符吗?
-
我已将其设置为 StoryBoardID,但我认为 TabBarController 不是我想要呈现的正确 Controller。我刚刚编辑了我的问题,很抱歉,我无法发布更好的故事板图片,谢谢
-
崩溃线是什么?我在你的截图上看不到任何东西。你想显示什么视图控制器?
-
崩溃行是致命错误:在展开可选值时意外发现 nil,-> 0x1006165dc : brk #0x1,我想显示 UserProfileVC,这是最后一个故事板图片圣底部。我可以做到,但后来我的 TabBarController 和 SWRevealController 消失了
-
或者我可以设置任何视图控制器并从那里执行 segue?
标签: swift uitabbarcontroller swrevealviewcontroller presentviewcontroller