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

时间:2017-01-24 12:23:39

标签: ios objective-c mmdrawercontroller

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

我该怎么做?

2 个答案:

答案 0 :(得分:1)

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
    }

答案 1 :(得分:0)

您必须在define de DrawerController时启用手势。这段代码是Swift,但它在ObjC中非常相似

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

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

我把MMOpenDrawerGestureMode.None,因为我用一个按钮打开菜单。如果您想用手势打开,可以在该行中定义