<!--
{
  "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/scrollRectToVisible(_:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIScrollView(im)scrollRectToVisible:animated:"
  },
  "title" : "scrollRectToVisible(_:animated:)"
}
-->

# scrollRectToVisible(_:animated:)

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

```
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`

<doc://com.apple.documentation/documentation/Swift/true> if the scrolling should be animated, <doc://com.apple.documentation/documentation/Swift/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.

---

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)