UIScrollView reset contentOffice
I have a UIScrollView whose content is shifting all the time for some random reason. Has anyone ever encountered this problem? I had the content offset to 100 and then it resets back the scroll to the top. Any way to prevent this?
So here is the code / hack I did to get it working in the contentOffset setting:
[self.currentViewController_ performSelector:@selector(scrollToOffset:) withObject:nil afterDelay:0.1];
and in my currentViewController class I have
-(void)scrollToOffset: (CGFloat) yOffset
{
[[self.webView_ defaultScrollView] setContentOffset:CGPointMake(0, -44) animated:YES];
}
+3
source to share
3 answers