自从对 IOS8 进行了新的更新后,我在滚动视图中的内容视图上多了一个空白区域.我的内容视图应该在我的滚动视图中居中,并且在 IOS7 上运行良好.
Since the new update to IOS8, i have an extra white space over my contentview in my scrollview. My content view should be centered in my scrollview and it's work fine on IOS7.
结果如下:
这是没有空格的情节提要版本:
Here is the storyboard version which doesn't have white space :
我想知道是什么导致了这个额外的空间,ios8 中有什么新东西会导致我的内容视图有额外的空间吗?
I'm wondering what could cause this extra space, is there anything new in ios8 that will cause my content view to have extra space ?
也许我需要改变我的视图布局方式?
Maybe i need to change how i layout my view ?
谢谢!
编辑:我的解决方案是仅取消选中出现问题的视图中的调整滚动条插入.但是,我接受的以下解决方案也有效.
EDIT: My solution was to only uncheck adjust scroll bar inset in my views which had the problem. However the solution below that i accepted works too.
我遇到了同样的问题,我想出了两个可能的解决方案,这两个都很糟糕,让我作为程序员感到羞耻:
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:
-64
,即额外空间的高度.我不知道为什么.UIImageView
作为 UIScrollView
的兄弟,并将其约束为与根视图的所有四个边齐平.-64
, which is the height of the extra space. I don't know why.UIImageView
as a sibling of the UIScrollView
, and constrain it to be flush with all four sides of the root view.我希望这只是 iOS 8 的一个错误,这样我就可以拿出我的 hack 并从窗台上走下来.
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.
这篇关于自 IOS 8 以来使用自动布局和滚动视图的额外顶部空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!