IPhone Development notes (14) UIScrollView boundary handling problems

Source: Internet
Author: User

The UIScrollView boundary processing problem is ignored in the combination of scrollView and pageControl in iPhone development Note (5. There is an important attribute bounces in UIScrollView. The following is the definition of this attribute in Apple's development document.

Bounces

A Boolean value that controls whether the scroll view bounces past the edge of content and back again.

@ Property (nonatomic) BOOL bounces
Discussion
If the value of this property is YES, the scroll view bounces when it encounters a boundary of the content. bouncing always indicates that scrolling has reached an edge of the content. if the value is NO, scrolling stops immediately at the content boundary without bouncing. the default value is YES.

Availability
Available in iOS 2.0 and later.

(1) When the bounces attribute is set to YES, when the image in UIScrollView slides to the boundary, it will pop up, just like the jelly effect in Linux.

(2) When the bounces attribute is set to NO, when the image in UIScrollView slides to the boundary, it will be directly set at the boundary and there will be NO bounce effect.


I set the bounces attribute to NO, which solves a bug. That is, when sliding to the leftmost image, sliding to the left won't be able to slide, and sliding to the right is the same. This solves the crash caused by array out-of-bounds.

Related Article

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.