Instance Method

scrollRectToVisible(_:animated:)

Scrolls a specific area of the content so that it is visible in the receiver.

Declaration

func scrollRectToVisible(_ rect: CGRect, animated: Bool)

Parameters

rect

A rectangle defining an area of the content view. The rectangle should be in the coordinate space of the scroll view.

animated

true if the scrolling should be animated, false if it should be immediate.

Discussion

This method scrolls the content view so that the area defined by rect is just visible inside the scroll view. If the area is already visible, the method does nothing.

See Also

Managing Scrolling

var isScrollEnabled: Bool

A Boolean value that determines whether scrolling is enabled.

var isDirectionalLockEnabled: Bool

A Boolean value that determines whether scrolling is disabled in a particular direction.

var scrollsToTop: Bool

A Boolean value that controls whether the scroll-to-top gesture is enabled.

var isPagingEnabled: Bool

A Boolean value that determines whether paging is enabled for the scroll view.

var bounces: Bool

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

var alwaysBounceVertical: Bool

A Boolean value that determines whether bouncing always occurs when vertical scrolling reaches the end of the content.

var alwaysBounceHorizontal: Bool

A Boolean value that determines whether bouncing always occurs when horizontal scrolling reaches the end of the content view.

func touchesShouldBegin(Set<UITouch>, with: UIEvent?, in: UIView)

Overridden by subclasses to customize the default behavior when a finger touches down in displayed content.

func touchesShouldCancel(in: UIView)

Returns whether to cancel touches related to the content subview and start dragging.

var canCancelContentTouches: Bool

A Boolean value that controls whether touches in the content view always lead to tracking.

var delaysContentTouches: Bool

A Boolean value that determines whether the scroll view delays the handling of touch-down gestures.

var decelerationRate: CGFloat

A floating-point value that determines the rate of deceleration after the user lifts their finger.

var isDragging: Bool

A Boolean value that indicates whether the user has begun scrolling the content.

var isTracking: Bool

Returns whether the user has touched the content to initiate scrolling.

var isDecelerating: Bool

Returns whether the content is moving in the scroll view after the user lifted their finger.

var directionalPressGestureRecognizer: UIGestureRecognizer

The underlying gesture recognizer for directional button presses.