Open yasencoder opened 6 years ago
@SunGuok 我也发现了
现在不在内部处理手势冲突问题了,需要自己通过UIGestureRecognizerDelegate去解决
遇到相同的问题,怎么改? 我把以前的代码又复制回来了,会引起什么问题吗?
@xyxdasnjss 没有问题的,只不过觉得这样实现不是特别好就删掉了哈
可以使用method swizzle 解决
static void swizzle(Class class, SEL original, SEL new) { Method originalMethod = class_getInstanceMethod(class, original); Method newMethod = class_getInstanceMethod(class, new); if (class_addMethod(class, original, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) { class_replaceMethod(class, new, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); } else { method_exchangeImplementations(originalMethod, newMethod); } }
@implementation WMScrollView (YXAdd)
(void)load { swizzle(self, @selector(gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:), @selector(yx_gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:)); }
(BOOL)yx_gestureRecognizer:(UIGestureRecognizer )gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer )otherGestureRecognizer { if (self.contentOffset.x <= 0) { if ([otherGestureRecognizer.delegate isKindOfClass:NSClassFromString(@"_FDFullscreenPopGestureRecognizerDelegate")]) { return true; } } return false; }
@end
上面的方法解决了我的问题,写一个继承WMScrollView的分类就可以0行代码解决与FDFullscreenPopGesture搭配的问题.感谢.
@sushushu 你好,能否详细说一下你是怎么解决的啊,谢谢
@xinghanjie 你好,是直接像上面的代码一样写一个WMScrollView的扩展类就行了吗,怎么样才能让扩展类里面的代码执行啊??
@theHeroisBack 只要把这个category写好就行了,+ load方法会在程序启动之前完成方法交换的
@xinghanjie 谢谢!完美解决
@xinghanjie 我写了.好像不起作用呀
@xinghanjie 可以了.我代码写错了.谢谢您
继承WMPageController 的VC,iOS11 上侧滑无效,2.3.0 版本的是可以侧滑的