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.