ios - 带有 Pan 手势冲突的 ScrollView 和侧边菜单

标签 ios objective-c xcode swift

我正在快速设计一个包含左侧菜单的应用程序。 我使用导航 Controller 来识别平移,具体取决于我切换的左侧菜单。

下面是使用导航 Controller 附加平移手势的代码

let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: "handlePanGesture:")
    centerNavigationController.view.addGestureRecognizer(panGestureRecognizer)*

在其他 Controller 中,它工作正常,但在有 ScrollView 的 Controller 中,我希望 ScrollView 滚动到内容偏移量 0 并在左侧进一步滚动后,它应该打开左侧菜单。 但它会阻止调用平移手势。

这是矛盾的。

我尝试了很多使用方法的解决方案

func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {}

但是没有用。

如果需要任何其他信息来定义问题,请告诉我。

提前致谢。

最佳答案

https://github.com/John-Lluch/SWRevealViewController

使用 SwrevealviewController ,你会得到所有这些东西

关于ios - 带有 Pan 手势冲突的 ScrollView 和侧边菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35936824/

相关文章:

iphone - AVAudioPlayer 改变声音节奏?

iphone - 如何以编程方式访问通知设置

objective-c - 当前日期和时间 - NSDate

ios - 触摸父 View 时关闭 subview

iOS 13 : MPMediaPickerController - Internal Error/The requested app extension could not be found

ios - 从 GLBuffer 中删除顶点

ios - 调用实例函数是我的错误,对吧?

ios - MailCompositionService 意外退出 ios

ios - 无效更新 : invalid number of rows in section 0 terminating with uncaught exception of type NSException

ios - 如何在 Xcode 中旋转 UISwitch?