我在swift中使用revealviewcontroller。成功登录后,我的控件应该显示视图控制器。但是当我移动显示视图控制器时,我的menubarbutton无效。
let svc :SWRevealViewController = self.storyboard?.instantiateViewControllerWithIdentifier("reveal") as! SWRevealViewController
let navigationController = UINavigationController(rootViewController: svc)
self.presentViewController(navigationController, animated: true, completion: nil)
答案 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的对象......
我希望你明白......
由于