<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIScrollView",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIScrollView"
  },
  "title" : "UIScrollView"
}
-->

# UIScrollView

A view that allows the scrolling and zooming of its contained views.

```
@MainActor class UIScrollView
```

## Overview

[`UIScrollView`](/documentation/UIKit/UIScrollView) is the superclass of several UIKit classes, including [`UITableView`](/documentation/UIKit/UITableView) and [`UITextView`](/documentation/UIKit/UITextView).

A scroll view is a view with an origin that’s adjustable over the content view. It clips the content to its frame, which generally (but not necessarily) coincides with that of the app’s main window. A scroll view tracks the movements of fingers, and adjusts the origin accordingly. The view that shows its content through the scroll view draws that portion of itself according to the new origin, which is pinned to an offset in the content view. The scroll view itself does no drawing except for displaying vertical and horizontal scroll indicators. The scroll view must know the size of the content view so it knows when to stop scrolling. By default, it *bounces* back when scrolling exceeds the bounds of the content.

The object that manages the drawing of content that displays in a scroll view needs to tile the content’s subviews so that no view exceeds the size of the screen. As users scroll in the scroll view, this object adds and removes subviews as necessary.

Because a scroll view has no scroll bars, it must know whether a touch signals an intent to scroll versus an intent to track a subview in the content. To make this determination, it temporarily intercepts a touch-down event by starting a timer and, before the timer fires, seeing if the touching finger makes any movement. If the timer fires without a significant change in position, the scroll view sends tracking events to the touched subview of the content view. If the user then drags their finger far enough before the timer elapses, the scroll view cancels any tracking in the subview and performs the scrolling itself. Subclasses can override the [`touchesShouldBegin(_:with:in:)`](/documentation/UIKit/UIScrollView/touchesShouldBegin(_:with:in:)), [`isPagingEnabled`](/documentation/UIKit/UIScrollView/isPagingEnabled), and [`touchesShouldCancel(in:)`](/documentation/UIKit/UIScrollView/touchesShouldCancel(in:)) methods (which the scroll view calls) to affect how the scroll view handles scrolling gestures.

A scroll view also handles zooming and panning of content. As the user makes a pinch-in or pinch-out gesture, the scroll view adjusts the offset and the scale of the content. When the gesture ends, the object managing the content view updates subviews of the content as necessary. (Note that the gesture can end and a finger might still be down.) While the gesture is in progress, the scroll view doesn’t send any tracking calls to the subview.

The [`UIScrollView`](/documentation/UIKit/UIScrollView) class can have a delegate that must adopt the [`UIScrollViewDelegate`](/documentation/UIKit/UIScrollViewDelegate) protocol. For zooming and panning to work, the delegate must implement both [`viewForZooming(in:)`](/documentation/UIKit/UIScrollViewDelegate/viewForZooming(in:)) and [`scrollViewDidEndZooming(_:with:atScale:)`](/documentation/UIKit/UIScrollViewDelegate/scrollViewDidEndZooming(_:with:atScale:)). In addition, the [`maximumZoomScale`](/documentation/UIKit/UIScrollView/maximumZoomScale) and [`minimumZoomScale`](/documentation/UIKit/UIScrollView/minimumZoomScale) zoom scales must be different.

### State preservation

If you assign a value to this view’s [`restorationIdentifier`](/documentation/UIKit/UIViewController/restorationIdentifier) property, it attempts to preserve its scrolling-related information between app launches. Specifically, the values of the [`zoomScale`](/documentation/UIKit/UIScrollView/zoomScale), [`contentInset`](/documentation/UIKit/UIScrollView/contentInset), and [`contentOffset`](/documentation/UIKit/UIScrollView/contentOffset) properties are preserved. During restoration, the scroll view restores these values so that the content appears scrolled to the same position as before. For more information about how state preservation and restoration works, see [App Programming Guide for iOS](https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007072).

## Topics

### Responding to scroll view interactions

[`delegate`](/documentation/UIKit/UIScrollView/delegate)

The delegate of the scroll view.

[`UIScrollViewDelegate`](/documentation/UIKit/UIScrollViewDelegate)

The interface for the delegate of a scroll view.

### Managing the content size and offset

[`contentSize`](/documentation/UIKit/UIScrollView/contentSize)

The size of the content view.

[`contentOffset`](/documentation/UIKit/UIScrollView/contentOffset)

The point at which the origin of the content view is offset from the origin of the scroll view.

[`setContentOffset(_:animated:)`](/documentation/UIKit/UIScrollView/setContentOffset(_:animated:))

Sets the offset from the content view’s origin that corresponds to the scroll view’s origin.

### Managing the content inset behavior

[`adjustedContentInset`](/documentation/UIKit/UIScrollView/adjustedContentInset)

The insets derived from the content insets and the safe area of the scroll view.

[`contentInset`](/documentation/UIKit/UIScrollView/contentInset)

The custom distance that the content view is inset from the safe area or scroll view edges.

[`contentInsetAdjustmentBehavior`](/documentation/UIKit/UIScrollView/contentInsetAdjustmentBehavior-swift.property)

The behavior for determining the adjusted content offsets.

[`UIScrollView.ContentInsetAdjustmentBehavior`](/documentation/UIKit/UIScrollView/ContentInsetAdjustmentBehavior-swift.enum)

Constants indicating how safe area insets are added to the adjusted content inset.

[`adjustedContentInsetDidChange()`](/documentation/UIKit/UIScrollView/adjustedContentInsetDidChange())

Notifies the scroll view when the adjusted content insets of the scroll view change.

### Getting the layout guides

[`frameLayoutGuide`](/documentation/UIKit/UIScrollView/frameLayoutGuide)

The layout guide based on the untransformed frame rectangle of the scroll view.

[`contentLayoutGuide`](/documentation/UIKit/UIScrollView/contentLayoutGuide)

The layout guide based on the untranslated content rectangle of the scroll view.

### Configuring the scroll view

[`isScrollEnabled`](/documentation/UIKit/UIScrollView/isScrollEnabled)

A Boolean value that determines whether scrolling is enabled.

[`isDirectionalLockEnabled`](/documentation/UIKit/UIScrollView/isDirectionalLockEnabled)

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

[`isPagingEnabled`](/documentation/UIKit/UIScrollView/isPagingEnabled)

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

[`scrollsToTop`](/documentation/UIKit/UIScrollView/scrollsToTop)

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

[`bounces`](/documentation/UIKit/UIScrollView/bounces)

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

[`bouncesHorizontally`](/documentation/UIKit/UIScrollView/bouncesHorizontally)

A Boolean value that determines whether the scroll view bounces when it reaches the ends of its horizontal axis.

[`bouncesVertically`](/documentation/UIKit/UIScrollView/bouncesVertically)

A Boolean value that determines whether the scroll view bounces when it reaches the ends of its vertical axis.

[`alwaysBounceVertical`](/documentation/UIKit/UIScrollView/alwaysBounceVertical)

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

[`alwaysBounceHorizontal`](/documentation/UIKit/UIScrollView/alwaysBounceHorizontal)

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

### Managing the scrolling state

[`isTracking`](/documentation/UIKit/UIScrollView/isTracking)

A Boolean value that indicates whether the user has touched the content to initiate scrolling.

[`isDragging`](/documentation/UIKit/UIScrollView/isDragging)

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

[`isDecelerating`](/documentation/UIKit/UIScrollView/isDecelerating)

A Boolean value that indicates whether the content is moving in the scroll view after the user lifted their finger.

[`isScrollAnimating`](/documentation/UIKit/UIScrollView/isScrollAnimating)

A Boolean value that indicates whether the scroll view is currently animating a scroll update.

[`stopScrollingAndZooming()`](/documentation/UIKit/UIScrollView/stopScrollingAndZooming())

Stops active scroll and zoom animations.

[`decelerationRate`](/documentation/UIKit/UIScrollView/decelerationRate-swift.property)

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

[`UIScrollView.DecelerationRate`](/documentation/UIKit/UIScrollView/DecelerationRate-swift.struct)

Deceleration rates for the scroll view.

### Applying edge effects

[`bottomEdgeEffect`](/documentation/UIKit/UIScrollView/bottomEdgeEffect)

The effect for the bottom edge of the scroll view.

[`leftEdgeEffect`](/documentation/UIKit/UIScrollView/leftEdgeEffect)

The effect for the left edge of the scroll view.

[`rightEdgeEffect`](/documentation/UIKit/UIScrollView/rightEdgeEffect)

The effect for the right edge of the scroll view.

[`topEdgeEffect`](/documentation/UIKit/UIScrollView/topEdgeEffect)

The effect for the top edge of the scroll view.

[`UIScrollEdgeEffect`](/documentation/UIKit/UIScrollEdgeEffect)

Properties of the effect on a particular edge of the scroll view.

[`UIScrollEdgeEffect.Style`](/documentation/UIKit/UIScrollEdgeEffect/Style-swift.class)

Styles for a scroll view’s edge effect.

### Managing the scroll indicator and refresh control

[`indicatorStyle`](/documentation/UIKit/UIScrollView/indicatorStyle-swift.property)

The style of the scroll indicators.

[`UIScrollView.IndicatorStyle`](/documentation/UIKit/UIScrollView/IndicatorStyle-swift.enum)

Defines constants that represent the styles of the scroll indicators.

[`showsHorizontalScrollIndicator`](/documentation/UIKit/UIScrollView/showsHorizontalScrollIndicator)

A Boolean value that controls whether the horizontal scroll indicator is visible.

[`showsVerticalScrollIndicator`](/documentation/UIKit/UIScrollView/showsVerticalScrollIndicator)

A Boolean value that controls whether the vertical scroll indicator is visible.

[`horizontalScrollIndicatorInsets`](/documentation/UIKit/UIScrollView/horizontalScrollIndicatorInsets)

The horizontal distance the scroll indicators are inset from the edge of the scroll view.

[`verticalScrollIndicatorInsets`](/documentation/UIKit/UIScrollView/verticalScrollIndicatorInsets)

The vertical distance the scroll indicators are inset from the edge of the scroll view.

[`automaticallyAdjustsScrollIndicatorInsets`](/documentation/UIKit/UIScrollView/automaticallyAdjustsScrollIndicatorInsets)

A Boolean value that indicates whether the system automatically adjusts the scroll indicator insets.

[`flashScrollIndicators()`](/documentation/UIKit/UIScrollView/flashScrollIndicators())

Displays the scroll indicators momentarily.

[`withScrollIndicatorsShown(forContentOffsetChanges:)`](/documentation/UIKit/UIScrollView/withScrollIndicatorsShown(forContentOffsetChanges:))

Displays the scroll indicators during updates to the scroll view’s content offset.

[`refreshControl`](/documentation/UIKit/UIScrollView/refreshControl)

The refresh control associated with the scroll view.

[`UIRefreshControl`](/documentation/UIKit/UIRefreshControl)

A standard control that can initiate the refreshing of a scroll view’s contents.

### Scrolling to a specific location

[`scrollRectToVisible(_:animated:)`](/documentation/UIKit/UIScrollView/scrollRectToVisible(_:animated:))

Scrolls a specific area of the content so that it’s visible in the scroll view.

### Managing touches

[`touchesShouldBegin(_:with:in:)`](/documentation/UIKit/UIScrollView/touchesShouldBegin(_:with:in:))

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

[`touchesShouldCancel(in:)`](/documentation/UIKit/UIScrollView/touchesShouldCancel(in:))

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

[`canCancelContentTouches`](/documentation/UIKit/UIScrollView/canCancelContentTouches)

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

[`delaysContentTouches`](/documentation/UIKit/UIScrollView/delaysContentTouches)

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

[`directionalPressGestureRecognizer`](/documentation/UIKit/UIScrollView/directionalPressGestureRecognizer)

The underlying gesture recognizer for directional button presses.

### Zooming and panning

[`panGestureRecognizer`](/documentation/UIKit/UIScrollView/panGestureRecognizer)

The underlying gesture recognizer for pan gestures.

[`pinchGestureRecognizer`](/documentation/UIKit/UIScrollView/pinchGestureRecognizer)

The underlying gesture recognizer for pinch gestures.

[`zoom(to:animated:)`](/documentation/UIKit/UIScrollView/zoom(to:animated:))

Zooms to a specific area of the content so that it’s visible in the scroll view.

[`zoomScale`](/documentation/UIKit/UIScrollView/zoomScale)

A floating-point value that specifies the current scale factor applied to the scroll view’s content.

[`setZoomScale(_:animated:)`](/documentation/UIKit/UIScrollView/setZoomScale(_:animated:))

A floating-point value that specifies the current zoom scale.

[`maximumZoomScale`](/documentation/UIKit/UIScrollView/maximumZoomScale)

A floating-point value that specifies the maximum scale factor that can apply to the scroll view’s content.

[`minimumZoomScale`](/documentation/UIKit/UIScrollView/minimumZoomScale)

A floating-point value that specifies the minimum scale factor that can apply to the scroll view’s content.

[`isZoomBouncing`](/documentation/UIKit/UIScrollView/isZoomBouncing)

A Boolean value that indicates that zooming has exceeded the scaling limits specified for the scroll view.

[`isZooming`](/documentation/UIKit/UIScrollView/isZooming)

A Boolean value that indicates whether the content view is currently zooming in or out.

[`isZoomAnimating`](/documentation/UIKit/UIScrollView/isZoomAnimating)

A Boolean value that indicates whether the scroll view is currently animating a zoom update.

[`bouncesZoom`](/documentation/UIKit/UIScrollView/bouncesZoom)

A Boolean value that determines whether the scroll view animates the content scaling when the scaling exceeds the maximum or minimum limits.

### Dismissing the keyboard

[`keyboardDismissMode`](/documentation/UIKit/UIScrollView/keyboardDismissMode-swift.property)

The manner in which the system dismisses the keyboard when a drag begins in the scroll view.

[`UIScrollView.KeyboardDismissMode`](/documentation/UIKit/UIScrollView/KeyboardDismissMode-swift.enum)

Constants that determine how the system dismisses the keyboard when a drag begins in the scroll view.

### Managing the index

[`indexDisplayMode`](/documentation/UIKit/UIScrollView/indexDisplayMode-swift.property)

The manner in which the index appears while the user is scrolling.

[`UIScrollView.IndexDisplayMode`](/documentation/UIKit/UIScrollView/IndexDisplayMode-swift.enum)

Defines constants that represent how the index appears while the user is scrolling.

### Controlling content alignment

[`contentAlignmentPoint`](/documentation/UIKit/UIScrollView/contentAlignmentPoint)

A point where the scroll view anchors content that’s smaller than the scroll view’s frame.

### Nesting scroll views

[`transfersHorizontalScrollingToParent`](/documentation/UIKit/UIScrollView/transfersHorizontalScrollingToParent)

A Boolean value that determines whether the scroll view passes horizontal scroll events to a superview.

[`transfersVerticalScrollingToParent`](/documentation/UIKit/UIScrollView/transfersVerticalScrollingToParent)

A Boolean value that determines whether the scroll view passes vertical scroll events to a superview.

### Deprecated

[`scrollIndicatorInsets`](/documentation/UIKit/UIScrollView/scrollIndicatorInsets)

The distance the scroll indicators are inset from the edge of the scroll view.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)