Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

content offset doesn't work

I am trying to set the content offset in my uiscrollview. I have tried the following, and none of it works. None of the following affect my scrollView in any way, it simple appears on the screen as normal.:

 let point = CGPoint(x: 0, y: self.view.frame.height / 2)
 self.scrollView.setContentOffset(point, animated: true)

and:

 self.scrollView.contentOffset.y = self.view.frame.size.height / 2

and:

 self.scrollView.contentOffset = CGPointMake(0, self.view.frame.size.height / 2)

and:

 self.scrollView.contentOffset = CGPointMake(0, scrollView.frame.size.height / 2)

I have a scroll view that is 2 times the height of my view. They are essentially separated into 2 different view that I can page between. I want the scrollview to start on the bottom part.

like image 483
jjjjjjjj Avatar asked Dec 19 '22 20:12

jjjjjjjj


1 Answers

You should try them in the viewDidLayoutSubviews

Ref: iOS 9 scroll UITextView to top

like image 129
tuledev Avatar answered Dec 24 '22 01:12

tuledev