我正在嘗試在我的應用程序中使用MMDrawerController,但是我無法在側視圖中使用手勢關閉側抽屜。我在我的應用程序中的其他地方使用了MMDrawerController,並取得了巨大成功,但無法弄清楚爲什麼它在這種情況下不起作用。MMDrawerController無法關閉抽屜
頂級視圖控制器是一個UINavigationController,其默認視圖控制器是MasterViewController(下面的源代碼)。這個類擴展MMDrawerController併爲我想要的配置視圖(中心和右邊,關閉手勢,最大寬度)。中央視圖有一個打開抽屜的按鈕。抽屜打開後,我無法用中央視圖上的手勢將其關閉。我向抽屜中添加了一個按鈕,它可以通過編程關閉抽屜,但我需要能夠在中央視圖上進行製表/平移。
類MasterViewController:MMDrawerController {
override func viewDidLoad() {
let centerView = storyboard!.instantiateViewControllerWithIdentifier("CenterControllerName") as? CenterControllerType
super.setCenterViewController(centerView, withCloseAnimation: false, completion: nil)
let drawer = storyboard!.instantiateViewControllerWithIdentifier("Drawer") as? DrawerType
super.rightDrawerViewController = drawer
super.setMaximumRightDrawerWidth(200, animated: true, completion: nil)
super.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.PanningCenterView | MMCloseDrawerGestureMode.TapCenterView
}
}
打開抽屜的功能:
@IBAction func drawerButtonPressed(sender: AnyObject) {
drawer?.openDrawerSide(MMDrawerSide.Right, animated: true, completion: nil)
}
嘿蘭迪,我有相同的問題,因爲相當多的時間。你能提供更多關於你的解決方案的信息嗎?謝謝 – 2016-01-13 08:39:31
問題在於您的手勢是針對給定的VC定義的,但是當您打開抽屜時,它會將當前的VC更改爲新的VC,並且之前的VC僅顯示,但無法交互與 – 2016-01-13 08:41:24
好吧我修復它,唐娜寫一個答案 – 2016-01-13 08:47:49