简体   繁体   English

拖动部分标题视图时防止UITableView滚动

[英]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. 我在表格视图中有一个超高(220pt)部分标题,该标题显示在应用购买信息中。 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. 我尝试将视图设置为exclusiveTouch = YES ,甚至禁用了userInteraction但是tableview坚持滚动。

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. 我尝试覆盖beginTouches等,但是它们仍然传递给了表格视图,因此最后我放弃了使用节标题视图,而是将视图插入了表格视图上方。 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. 该视图在情节提要中设置了固定的220pt高度,并且将NSLayoutConstraint设置为IBOutlet,因此在隐藏视图时可以将其高度设置为0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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