您好我目前在项目中遇到导航栏问题。我有一个Facebook登录,成功登录后,用户可以访问与标签栏控制器连接的活动源。成功登录后,我使用以下代码将用户带到特定屏幕:
func controllingNavigationAfterLogin()
{ let vcPage = self.storyboard?.instantiateViewControllerWithIdentifier("YourViewControllerStoryboardID") as! YourViewControllerClassName
let vcPageNav = UINavigationController(rootViewController: vcPage)
let appDel = UIApplication.sharedApplication().delegate as! AppDelegate appDelegate.window?.rootViewController = vcPageNav
}
此处的标识符表示tabbarcontroller的storyboard id。直到现在一切正常但我的导航标题由于某些原因而丢失,我找不到。如果有人可以帮助我,这将是伟大的!
答案 0 :(得分:1)
为tabBarController设置StoryboardID并尝试:
let tabBarController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("TabBarController")
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window?.rootViewController = tabBarController