1 rebound mechanism: bounces alwaysbouncehorizontal alwaysbouncevertical
Bounces: Describes whether the display of ScrollView is elastic when it exceeds the edge of the content area and returns, and the default value is yes. When the value is yes, it means that when you reach the boundary depicted by contentsize, the drag creates elasticity. When the value is no, when the drag reaches the boundary, it stops immediately. So, if you set bounces to no in the example above, the window will not show content outside the Contentsize range.
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {NSLog(@"%f",tableV.contentOffset.y);if (tableV.contentOffset.y <= 0) { tableV.bounces = NO; NSLog(@"禁止下拉");}elseif (tableV.contentOffset.y >= 0){ tableV.bounces = YES; NSLog(@"允许上拉");}}
Change the offset of the ScrollView
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {CGPoint offset = tableV.contentOffset;if (offset.y <= 0) { offset.y = 0;}tableV.contentOffset = offset;}
Iostableview prohibit pull-down, allow pull-up