Weird interface bug UIScrollView in UITabBarController. Reproducible by others?

孤街浪徒 提交于 2019-12-04 15:51:12

After googeling I found the answer in another StackOverflow question.

What you need to do is save the scrollview.contentOffset on viewWillDisappear, set it to CGPointZero on viewDidDisappear and set it back to the saved state on viewDidLayoutSubviews:

-(void) viewWillDisappear: (BOOL) animated { 
 self.lastContentOffset = self.scrollView.contentOffset;
[super viewWillDisappear: animated];
}

-(void) viewDidDisappear:(BOOL)animated {
[super viewDidDisappear: animated];
self.scrollView.contentOffset = CGPointZero;
}
- (void)viewDidLayoutSubviews {
[super viewDidlayoutSubviews];
self.scrollView.contentOffset = self.lastContentOffset;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!