iOS 当使用FD_FullscreenPopViewController的时候遇到scrollView右滑手势无法使用的解决
2017-03-23 18:59
603 查看
当我们在ViewController中有scrollView的时候, 可能会遇到右滑无法响应返回手势, 有以下解决办法:
自定义scrollView, 实现该scrollView的以下方法即可:
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.5px Menlo; color: #000000 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.5px Menlo; color: #000000; min-height: 16.0px }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.5px Menlo; color: #008400 }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.5px Menlo; color: #ba2da2 }
span.s1 { color: #ba2da2 }
span.s2 { }
span.s3 { color: #703daa }
span.s4 { color: #000000 }
span.s5 { font: 13.5px "PingFang SC" }
span.s6 { color: #3e1e81 }
span.s7 { color: #d12f1b }
span.s8 { color: #272ad8 }
@implementation GOfflineContentScrollView
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
// 首先判断otherGestureRecognizer是不是系统pop手势
if ([otherGestureRecognizer.view isKindOfClass:NSClassFromString(@"UILayoutContainerView")]) {
// 再判断系统手势的state是began还是fail,同时判断scrollView的位置是不是正好在最左边
if (otherGestureRecognizer.state == UIGestureRecognizerStateBegan && self.contentOffset.x == 0) {
return YES;
}
}
return NO;
}
@end
自定义scrollView, 实现该scrollView的以下方法即可:
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.5px Menlo; color: #000000 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.5px Menlo; color: #000000; min-height: 16.0px }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.5px Menlo; color: #008400 }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.5px Menlo; color: #ba2da2 }
span.s1 { color: #ba2da2 }
span.s2 { }
span.s3 { color: #703daa }
span.s4 { color: #000000 }
span.s5 { font: 13.5px "PingFang SC" }
span.s6 { color: #3e1e81 }
span.s7 { color: #d12f1b }
span.s8 { color: #272ad8 }
@implementation GOfflineContentScrollView
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
// 首先判断otherGestureRecognizer是不是系统pop手势
if ([otherGestureRecognizer.view isKindOfClass:NSClassFromString(@"UILayoutContainerView")]) {
// 再判断系统手势的state是began还是fail,同时判断scrollView的位置是不是正好在最左边
if (otherGestureRecognizer.state == UIGestureRecognizerStateBegan && self.contentOffset.x == 0) {
return YES;
}
}
return NO;
}
@end
相关文章推荐
- 使用FDFullscreenPopGesture遇到的坑以及解决方法
- 使用FDFullscreenPopGesture遇到的坑以及解决方法
- iOS 使用 WKWebView 无法截获上、下手势的问题解决
- [iOS]FDFullscreenPopGesture 全局返回手势 与 pan手势冲突
- ios编程——使用抽屉MMDrawerController和系统手势interactivePopGestureRecognizer冲突的解决方法
- iOS解决使用模态视图 导致无法pushViewController
- iOS解决使用模态视图 导致无法pushViewController
- iOS 7 popViewController Bug解决
- ScrollView与WebView结合使用时,设置webview字体大小的时候出现下方留白解决
- thinkphp使用view的时候无法利用phpexcel导出数据问题的解决
- 含有按钮的ScrollView在iOS8中无法滚动的解决办法 | ScrollView with UIControl/UIButton subviews not scrollable under iOS 8
- 在使用UIImagePickerViewcontroller的时候,状态栏的颜色会被改变的解决办法
- iOS基础: navigationController.popToViewController的使用
- iOS开发-自定义TabBar使用popToRootViewControllerAnimated重叠问题解决
- IOS navigationController.popToViewController的使用
- Android 关于使用ScrollView和RecyclerView 时候Topbar被隐藏解决方式
- 解决 iOS ViewController Push或者Pop 时的黑影
- iOS自定义tabbar后popToRootViewContriller和poptoviewcontroller时出现两个tabbar 的解决办法
- iOS横向滚动的scrollView和系统pop手势返回冲突的解决办法
- 全屏POP手势动画(FDFullscreenPopGesture)