2016-03-06 47 views
0

我有Login.storyboardSegue公司出一个UINavigationController栈来的UITabBarController

enter image description here

Login View Controller有Segue公司,以一个Storyboard参考和故事板main.storyboard

​​

我LoginViewController类代码有一个TouchUpInside动作处理程序,它以编程方式将该segue调用为main.storyboard

@IBAction func btnLoginTouchUpInside(sender: UIButton) { 
     let params = AuthLoginParams(Username: txtFieldUsername.text!, Password: txtFieldPassword.text!) 

     AuthLoginRequest.FetchUser(params) { (userModel) -> Void in 
      if(userModel.IsAuthorized){ 
       self.performSegueWithIdentifier("mainStoryboardSegue", sender: nil) 
      }else{ 

      } 
     } 
    } 

现在让我们来看看main.storyboard

enter image description here

Login.storyboard

所以 - >登录成功赛格瑞 - >Main.storyboard我想原因请看 “出” 一UINavigationController堆栈,并开始新的/新用一个UITabBarController。下面是一个屏幕截图,如果我开始我的应用程序main.storyboard并跳过Login.storyboardenter image description here

但是,如果我开始我的应用程序Login.storyboard和尝试使用我的原因请看Stoyboard参考main.storyboardself.performSegueWithIdentifier("mainStoryboardSegue", sender: nil)

我仍然登录过程UINavBarController堆,其中,我不想:

enter image description here

+0

你不能用简单的继续来做你想做的事。你需要实例化你的标签栏控制器,并用它替换窗口的根视图控制器。这将删除导航控制器。或者,您可以隐藏导航栏 – Paulw11

+0

明白了,谢谢@ Paulw11 –

回答

0

感谢@ Paulw11的小费在我的问题的意见,他STAT ED,我不能做什么,我试图用一个简单的SEGUE,我不得不programmtically改变RootViewController的,这就是我想出的代码,包括过渡amimation和所有似乎很好地工作:

let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) 
let viewController = mainStoryboard.instantiateViewControllerWithIdentifier("dashboardTabBarController") as! DashboardTabBarController 

UIView.transitionWithView(self.view.window!, duration: 0.5, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: { 
        UIApplication.sharedApplication().keyWindow?.rootViewController = viewController; 
        }, completion: nil)