OGeek|极客世界-中国程序员成长平台

标题: ios - SWRevealViewController 平移手势识别器问题 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:51
标题: ios - SWRevealViewController 平移手势识别器问题

我正在使用来自 John-Lluch 的 SWRevealViewController。我需要使用平移手势来查看侧边栏,并且我正在使用滑动来查看我的上一篇和下一篇文章。但是,只能检测到平移手势。

更新:如果我禁用平移手势,我的滑动手势会起作用。

平移手势

 [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];

滑动手势

UISwipeGestureRecognizer *left = [[[UISwipeGestureRecognizer alloc] initWithTarget:self actionselector(swipeLeft] autorelease];
left.direction = UISwipeGestureRecognizerDirectionLeft;

UISwipeGestureRecognizer *right = [[[UISwipeGestureRecognizer alloc] initWithTarget:self actionselector(swipeRight] autorelease];
right.direction = UISwipeGestureRecognizerDirectionRight;

[self.view addGestureRecognizer:left];
[self.view addGestureRecognizer:right];



Best Answer-推荐答案


[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];

[self.view addGestureRecognizer:left];

注意到区别了吗?将 SwipeGesture 实现为您的 .h 中的属性,或将其放入您的 .xib 并将其链接到您的 .h

关于ios - SWRevealViewController 平移手势识别器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24906318/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4