Note that there are some explanatory texts on larger screens.

plurals
  1. POUIScrollView: difference between setContentOffset:animated and scrollRectToVisible:animated
    text
    copied!<p>I have read Apple Scroll View Programming Guide for iOS but still confused about the following part:</p> <blockquote> <p><strong>Scrolling to a Specific Offset</strong></p> <p>Scrolling to a specific top-left location (the contentOffset property) can be accomplished in two ways. The setContentOffset:animated: method scrolls the content to the specified content offset. If the animated parameter is YES, the scrolling will animate from the current position to the specified position at a constant rate. If the animated parameter is NO, the scrolling is immediate and no animation takes place. In both cases, the delegate is sent a scrollViewDidScroll: message. If animation is disabled, or if you set the content offset by setting the contentOffset property directly, the delegate receives a single scrollViewDidScroll: message. If animation is enabled, then the delegate receives a series of scrollViewDidScroll: messages as the animation is in progress. When the animation is complete, the delegate receives a scrollViewDidEndScrollingAnimation: message.</p> <p><strong>Making a rectangle visible</strong></p> <p>It is also possible to scroll a rectangular area so that it is visible. This is especially useful when an application needs to display a control that is currently outside the visible area into the visible view. The scrollRectToVisible:animated: method scrolls the specified rectangle so that it is just visible inside the scroll view. If the animated parameter is YES, the rectangle is scrolled into view at a constant pace. As with setContentOffset:animated:, if animation is disabled, the delegate is sent a single scrollViewDidScroll: message. If animation is enabled, the delegate is sent a series of scrollViewDidScroll: messages as animation progresses. In the case of scrollRectToVisible:animated: the scroll view’s tracking and dragging properties are also NO.</p> <p>If animation is enabled for scrollRectToVisible:animated:, the delegate receives a scrollViewDidEndScrollingAnimation: message, providing notification that the scroll view has arrived at the specified location and animation is complete.</p> </blockquote> <p>I think it is quite similar between setContentOffset:animated and scrollRectToVisible:animated, could someone give some hints about them?</p> <p>And scrollRectToVisible:animated: is similar to scrollViewDidEndDecelerating:animated: too.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload