Iostableview prohibit pull-down, allow pull-up

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.