문제

I'm trying to make an app load already scrolled to the bottom of a UIView that I've got setup.

I did some research and found the setContentOffset:animated: method to get the point that I want. But as anybody who's also familiar with that method will know, the content offset asks for a CGPoint. I'm not exactly sure how to retrieve the bottom of a UIView with a CGPoint.

I've tried looking for somebody else who has asked how to do what I'm trying to do, and to my amazement, I didn't actually find anyone who had asked how to detect the bottom of a UIView, and then set the content offset to that point.

I would post some sample code, but I wouldn't even know where to start.

Could anybody help move me in the right direction? Thanks!

도움이 되었습니까?

해결책

You can use this for scrolling the UIScrollView to the bottom of the View

CGPoint bottom = CGPointMake(0, scrollView.contentSize.height - self.scrollView.bounds.size.height);
[scrollView setContentOffset:bottom animated:YES];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top