简体   繁体   中英

iOS UITableView prevent from scrolling

I want to get information about how UITableView would be scrolled without actually schange scrollView.contentOffset . I cant use scrollEnabled property becouse its stop fireing scrollViewDidScroll event on table and I need it. Is there any way to do it?

The question is a little bit hard to understand but in any case scrolling on a UITableView will modify contentOffset . That's how the superclass, UIScrollView , works.

As for scrollViewDidScroll , it is only called automatically when the user scrolls the view, but you can override setContentOffset to trigger it manually when needed. Just to avoid a loop set a BOOL dragging = YES flag on scrollViewWillBeginDragging: and clear it on scrollViewDidEndDragging:willDecelerate: .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM