如何在项目中间使用显示视图控制器而不是初始视图控制器

时间:2016-04-18 05:41:25

标签: ios swift

enter image description here我在swift中使用revealviewcontroller。成功登录后,我的控件应该显示视图控制器。但是当我移动显示视图控制器时,我的menubarbutton无效。

let svc :SWRevealViewController = self.storyboard?.instantiateViewControllerWithIdentifier("reveal") as! SWRevealViewController

let navigationController = UINavigationController(rootViewController: svc)

self.presentViewController(navigationController, animated: true, completion: nil)

1 个答案:

答案 0 :(得分:0)

在App代理

 let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate

 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate { 
 .....
 }

 fun rootVC()
 {
  let svc :SWRevealViewController = self.storyboard?.instantiateViewControllerWithIdentifier("reveal") as! SWRevealViewController
  let navigationController = UINavigationController(rootViewController: svc)
  self.presentViewController(navigationController, animated: true, completion: nil)
 }

设置初始化VC为LoginVC ...登录后输入安全密码...单击“提交呼叫rootVC”,如下所示

func SubmitAction(sender : UIButton)
{
 appDelegate.rootVC()
}

不需要在任何视图控制器中创建app delegate的对象......

我希望你明白......

由于