Contents

setContentScrollView(_:for:)

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

Declaration

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 Top or Bottom to set the scroll view for a specific edge, or pass All to set the scroll view for all edges.

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