最近我用这个库制作幻灯片菜单,我发现这个库给我左右滑动
https://github.com/dekatotoro/SlideMenuControllerSwift
如果我想禁用正确的菜单怎么办
或者如果我只想在一个控制器中显示它
我试图通过这样做禁用它
我删除了rightViewController,但操作仍然有效,并显示黑屏
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let mainViewController = storyboard.instantiateViewControllerWithIdentifier("SignInViewController") as! SignInViewController
let leftViewController = storyboard.instantiateViewControllerWithIdentifier("LeftViewController") as! LeftViewController
let nvc: UINavigationController = UINavigationController(rootViewController: mainViewController)
let slideMenuController = SlideMenuController(mainViewController:mvc, leftMenuViewController: leftViewController)
最佳答案
我通过在UIViewController.swift文件中编辑1行来修复它
func setNavigationBarItem() {
//self.addLeftBarButtonWithImage(UIImage(named: "ic_notifications_black_24dp")!)
self.addRightBarButtonWithImage(UIImage(named: "ic_menu_black_24dp")!)
self.slideMenuController()?.removeLeftGestures()
self.slideMenuController()?.removeRightGestures()
self.slideMenuController()?.addLeftGestures()
self.slideMenuController()?.addRightGestures()
}
^ _ ^