Extra top white space since IOS 8 using autolayout and scrollview

扶醉桌前 提交于 2019-11-30 05:20:25

I had this exact same problem, and I came up with two possible solutions, both of which are awful and make me ashamed to be a programmer:

  1. Constrain the scrollable view's top to the top of the scroll view, but with a constant of -64, which is the height of the extra space. I don't know why.
  2. Add an empty UIImageView as a sibling of the UIScrollView, and constrain it to be flush with all four sides of the root view.

I'm hoping that it's just an iOS 8 bug so that I can take out my hack and step down off the ledge.

I faced the same issue in iOS 8, following is solution I found: - Select View Contoller (in storybord) in which you have added the scroll view - In "Property Inspector" in "Layout" section un-check "Adjust Scroll View Insets"

theprojectabot

Try this at your viewDidLoad for that scrollview:

self.automaticallyAdjustsScrollViewInsets = NO;

untick the Extend Edges: under top bars of the main view and make the top distance of the subview 0 instead of negative value. this works for me.

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