简体   繁体   中英

Prevent UITableView from scrolling when section header view is dragged

I have a super-tall (220pt) section header on a table view that shows in app purchase information. When the user drags on the section header, the rows below scroll accordingly. It makes sense with a regular table view but in this case, the behaviour is weird.

Is there any way to prevent this happening? I've tried setting the view to exclusiveTouch = YES and even disabled userInteraction but the tableview insists on scrolling.

I tried overriding beganTouches etc but they still got passed to the table view, so in the end I abandoned using section header view and inserted the view above the table view. The view had a fixed 220pt height set in the storyboard and an NSLayoutConstraint as IBOutlet so its height could be set to 0 when the view was to be hidden.

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