UIScrollView中的UIView中的UITableView.滚动tableview时也不要滚动scrollview [英] UITableView in UIView in UIScrollView. When scrolling tableview don't scroll scrollview too

查看:76
本文介绍了UIScrollView中的UIView中的UITableView.滚动tableview时也不要滚动scrollview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UIScrollView内的UIView中有一个UITableView. 问题:当我滚动/拖动tableview时,scrollview也滚动.
我需要的是tableview不将滚动传递给scrollview.当我直接滚动它时,我还需要能够使用滚动视图. 我怎样才能做到这一点? 干杯

I have a UITableView inside a UIView inside a UIScrollView. Problem: when i scroll/drag the tableview, the scrollview scrolls too.
What i need is for the tableview not to pass the scroll to the scrollview. Also i need to be able to use the scrollview when i scroll it directly. How can i do this? Cheers

推荐答案

我在表格视图上使用"hitTest"修复了该问题.

I fixed it using "hitTest" on the tableview.

 - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event

如果该事件起源于tableview,我将禁用父级的scrollview滚动. 而且,当表视图的滚动结束时(scrollViewDidEndDragging),我将重新启用父级的滚动视图滚动.

If the event originated within the tableview, i disable the parent's scrollview scroll. And, when the tableview's scroll has ended (scrollViewDidEndDragging) i re-enable the parent's scrollview scroll.

这可以正常工作.

这篇关于UIScrollView中的UIView中的UITableView.滚动tableview时也不要滚动scrollview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆