Set UIScrollView.setContentOffset without scrolling?

2.6k Views Asked by At

I have a UIScrollView which shows a range of different plots. I want the UIScrollView to scroll from LEFT to RIGHT, so I want to set the ContentOffset of the UIScrollView to the "end" of the ContentOffset. I do it like this, which works:

var point = CGPointMake(scrollView.contentSize.width - scrollView.frame.size.width, 0)
scrollView.setContentOffset(point, animated: true)

However, this means that it will scroll the entire offset to that specific point, which results in the user seeing all the plots flashing by. Of course I would just like the UIScrollView to start at that particular point without scrolling to it, but I can't figure out what to do. If I set animated: false the scrolling stops working altogether.

Any help will be highly appreciated!

1

There are 1 best solutions below

1
On BEST ANSWER

You have to use the same method with 'false' but make sure you set the contentSize of the scrollview before you make the above call for scrolling to take effect.