最近我用这个库来制作幻灯片菜单,我发现这个库给我从左右滑动
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)
答案 0 :(得分:1)
我通过在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()
}
^ _ ^
答案 1 :(得分:0)
只需从您的代码中删除这两个方法即可实现技巧
self.slideMenuController()?.openRight()
self.slideMenuController()?.closeRight()
在github文档中明确提到它。
希望这可以帮助你...