我使用KYDrawercontroller滑出菜单我在uitableview中触摸按钮时编写代码来推送viewcontroller但它没有推 这是我的代码
@IBAction func m01(sender: AnyObject) {
let mainnav = self.storyboard!.instantiateViewControllerWithIdentifier("m02") as! UINavigationController //maindrawer
let mainnav2 = self.storyboard!.instantiateViewControllerWithIdentifier("mm") as! page1ViewController //pagetopush
mainnav.pushViewController(mainnav2, animated: true)
}
中的项目中查看
答案 0 :(得分:0)
使用以下代码替换您的
@IBAction func m01(sender: AnyObject) {
print("touched")
let mainnav2 = self.storyboard!.instantiateViewControllerWithIdentifier("mm") as! page1ViewController
let rootVC = UIApplication.sharedApplication().keyWindow?.rootViewController
let childrenVC = rootVC?.childViewControllers
let nc = childrenVC?.first as? UINavigationController
if let DrawerTableViewController = navigationController?.parentViewController as? KYDrawerController{
DrawerTableViewController.setDrawerState(.Closed, animated: true)
}
nc?.pushViewController(mainnav2, animated: true)
}
我更喜欢UIViewControllerAnimatedTransitioning协议来展示你的UI效果