wangmchn / WMPageController

An easy solution to page controllers like NetEase News
MIT License
2.92k stars 627 forks source link

iOS11 上,WMPageController 与FDFullscreenPopGesture冲突 #356

Open yasencoder opened 6 years ago

yasencoder commented 6 years ago

继承WMPageController 的VC,iOS11 上侧滑无效,2.3.0 版本的是可以侧滑的

loveuqian commented 6 years ago

@SunGuok 我也发现了

wangmchn commented 6 years ago

现在不在内部处理手势冲突问题了,需要自己通过UIGestureRecognizerDelegate去解决

xyxdasnjss commented 6 years ago

遇到相同的问题,怎么改? 我把以前的代码又复制回来了,会引起什么问题吗?

wangmchn commented 6 years ago

@xyxdasnjss 没有问题的,只不过觉得这样实现不是特别好就删掉了哈

xhjcs commented 6 years ago

可以使用method swizzle 解决

import "WMScrollView+YXAdd.h"

import <objc/runtime.h>

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)

@end

sushushu commented 6 years ago

上面的方法解决了我的问题,写一个继承WMScrollView的分类就可以0行代码解决与FDFullscreenPopGesture搭配的问题.感谢.

kaioser commented 6 years ago

@sushushu 你好,能否详细说一下你是怎么解决的啊,谢谢

kaioser commented 6 years ago

@xinghanjie 你好,是直接像上面的代码一样写一个WMScrollView的扩展类就行了吗,怎么样才能让扩展类里面的代码执行啊??

xhjcs commented 6 years ago

@theHeroisBack 只要把这个category写好就行了,+ load方法会在程序启动之前完成方法交换的

kaioser commented 6 years ago

@xinghanjie 谢谢!完美解决

tingyuyisheng commented 6 years ago

@xinghanjie 我写了.好像不起作用呀

tingyuyisheng commented 6 years ago

@xinghanjie 可以了.我代码写错了.谢谢您