MMdrawercontroller:打开左侧菜单时点击centerVC

MMdrawercontroller: click on the centerVC when the left menu is opened

我在 objective-c 应用程序中使用 MMdrawercontroller 来显示左侧菜单。我想在打开菜单时启用对 centerVC 显示的小部分的点击。

我该怎么做?

您必须在定义DrawerController 时启用手势。这段代码是Swift,但是在ObjC中会很相似

    centerContainer = MMDrawerController(centerViewController: self.centNav, rightDrawerViewController: rightViewController)

    centerContainer!.openDrawerGestureModeMask = MMOpenDrawerGestureMode.None
    centerContainer!.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView

我放MMOpenDrawerGestureMode.None是因为我用一个按钮打开菜单。如果你想用手势打开,你可以在那行定义

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        self.window = UIWindow(frame: UIScreen.main.bounds)

        // Suppose you have three ViewContollers 
        // Left , Front and Right

        let frontView = frontview(nibName: "frontview" , bundle: nil)
        let leftView = leftview(nibName: "leftview" , bundle: nil)
        let rightView = rightview(nibName: "rightview" , bundle: nil)


        let mmDrawerController = MMDrawerController(center: frontView, leftDrawerViewController: leftView, rightDrawerViewController: rightView)

        // Here you can use .all , .panningCenterView , .tapCenterView
        // as per your requirements..

        mmDrawerController?.openDrawerGestureModeMask = .all
        mmDrawerController?.closeDrawerGestureModeMask = .all

        self.window?.rootViewController = mmDrawerController
        self.window?.makeKeyAndVisible()

        return true
    }