因为IOS 8部外上方的空白自动版式使用滚动型和 [英] Extra top white space since IOS 8 using autolayout and scrollview
问题描述
由于新的更新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
,并限制它与所有四边平齐的根视图。
- 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. - Add an empty
UIImageView
as a sibling of theUIScrollView
, and constrain it to be flush with all four sides of the root view.
我的希望的,它只是一个iOS的8个bug,因此我可以拿出我的黑客和下台离开窗台。
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部外上方的空白自动版式使用滚动型和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!