1

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

我怎样才能做到这一点?

4

2 回答 2

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
    }
于 2017-01-24T13:13:04.990 回答
0

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

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

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

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

于 2017-01-24T12:34:12.427 回答