---
title: "setContentScrollView(_:for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontroller/setcontentscrollview(_:for:)"
---

# setContentScrollView(_:for:)

Sets the scroll view that bars observe for the specified edge.

## Declaration

```swift
func setContentScrollView(_ scrollView: UIScrollView?, for edge: NSDirectionalRectEdge)
```

## Parameters

- `scrollView`: The scroll view to observe. If nil, the view controller determines a scroll view automatically.
- `edge`: The edge to observe for scroll view content alignment. Pass doc://com.apple.uikit/documentation/UIKit/NSDirectionalRectEdge/top or doc://com.apple.uikit/documentation/UIKit/NSDirectionalRectEdge/bottom to set the scroll view for a specific edge, or pass doc://com.apple.uikit/documentation/UIKit/NSDirectionalRectEdge/all to set the scroll view for all edges.

## Discussion

Discussion Toolbars, navigation bars, and tab bars adjust their appearance when the edge of a scroll view’s content aligns with the edge of the bar. The view controller identifies a scroll view to observe by analyzing the view hierarchy to select a scroll view. If the view hierarchy is complex, the view controller might not select the appropriate scroll view to observe. Use this method to indicate a specific scroll view for the view controller to observe. To disable the scroll edge appearance for one or more edges, override contentScrollView(for:).

## See Also

### Working with scrolling content

- [setContentScrollView(_:)](uikit/uiviewcontroller/setcontentscrollview(_:).md)
- [contentScrollView(for:)](uikit/uiviewcontroller/contentscrollview(for:).md)
