0

I have a view which has a height of 1000 and it has a scrollView of the same height. When i click a button on the view i want to be able to move the view up to show lower sections of the view which is hidden on the screen frame. Since the screen has a field of view of 667 on iphone 6 for example.

I want to automatically scroll the view up to show the bottom of the view when a button is clicked.

Erent
  • 571
  • 6
  • 15
  • 29

1 Answers1

1

You can scroll the scrollView to bottom as below once you get the tap,

scrollView.setContentOffset(CGPoint(x: 0, y: scrollView.contentSize.height), animated: true)

You should be careful on setting the height of the view(currently you set it 1000) because if the scrollView does not have content more than this height it will not scroll. Better you keep the height of the view as the screen height and then you can scroll your scrollView to whatever position by changing y as above.

Kamran
  • 14,987
  • 4
  • 33
  • 51