Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView in UIView in UIScrollView. When scrolling tableview don't scroll scrollview too

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

enter image description here

like image 286
Victor C. Avatar asked Dec 12 '25 16:12

Victor C.


1 Answers

I fixed it using "hitTest" on the tableview.

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

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.

This seams to work fine.

like image 175
Victor C. Avatar answered Dec 16 '25 01:12

Victor C.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!