Programmatically scroll a UIScrollView to the top of a child UIView (subview) in Swift

后端 未结 11 1627
遇见更好的自我
遇见更好的自我 2020-12-29 03:35

I have a few screens worth of content within my UIScrollView which only scrolls vertically.

I want to programmatically scroll to a view contained somewhere in it\'s

11条回答
  •  没有蜡笔的小新
    2020-12-29 03:43

    scrollView.setContentOffset(CGPoint, animated: Bool)
    

    Where the point's y coordinate is the y coordinate of the frame of the view you want to show relatively to the scrollView's content view.

提交回复
热议问题