UIScrollView shifts below navigation and status bar

核能气质少年 提交于 2019-12-03 17:28:21

There appears to be some special handling inside UIScrollView when the navigation toolbars are toggled. As you pointed out at the end of your question, if you put the scroll view inside a containing UIView, this repositioning problem does not occur.

To fix the landscape issues, make sure you're setting the autoresizingMask on both the container view and the scroll view. I did not have to add any additional handling for landscape mode in my project.

I found the solution myself. In my tap detecting code's else fn I add the below line in the last.

scrollView.contentOffset = CGPointMake(parentScrollView.contentOffset.x,0);

Not sure if this is the right approach. But if anyone can suggest a better approach - more than welcome!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!