• <i id='sXtzL'><tr id='sXtzL'><dt id='sXtzL'><q id='sXtzL'><span id='sXtzL'><b id='sXtzL'><form id='sXtzL'><ins id='sXtzL'></ins><ul id='sXtzL'></ul><sub id='sXtzL'></sub></form><legend id='sXtzL'></legend><bdo id='sXtzL'><pre id='sXtzL'><center id='sXtzL'></center></pre></bdo></b><th id='sXtzL'></th></span></q></dt></tr></i><div id='sXtzL'><tfoot id='sXtzL'></tfoot><dl id='sXtzL'><fieldset id='sXtzL'></fieldset></dl></div>

      <bdo id='sXtzL'></bdo><ul id='sXtzL'></ul>

      1. <tfoot id='sXtzL'></tfoot>

        <legend id='sXtzL'><style id='sXtzL'><dir id='sXtzL'><q id='sXtzL'></q></dir></style></legend>
      2. <small id='sXtzL'></small><noframes id='sXtzL'>

      3. 自 IOS 8 以来使用自动布局和滚动视图的额外顶部空白

        时间:2023-09-10
        1. <i id='9MRgg'><tr id='9MRgg'><dt id='9MRgg'><q id='9MRgg'><span id='9MRgg'><b id='9MRgg'><form id='9MRgg'><ins id='9MRgg'></ins><ul id='9MRgg'></ul><sub id='9MRgg'></sub></form><legend id='9MRgg'></legend><bdo id='9MRgg'><pre id='9MRgg'><center id='9MRgg'></center></pre></bdo></b><th id='9MRgg'></th></span></q></dt></tr></i><div id='9MRgg'><tfoot id='9MRgg'></tfoot><dl id='9MRgg'><fieldset id='9MRgg'></fieldset></dl></div>
          <legend id='9MRgg'><style id='9MRgg'><dir id='9MRgg'><q id='9MRgg'></q></dir></style></legend>
            <tbody id='9MRgg'></tbody>

          <small id='9MRgg'></small><noframes id='9MRgg'>

            <tfoot id='9MRgg'></tfoot>
              <bdo id='9MRgg'></bdo><ul id='9MRgg'></ul>

                  本文介绍了自 IOS 8 以来使用自动布局和滚动视图的额外顶部空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  自从对 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:

                  1. 将可滚动视图的顶部约束到滚动视图的顶部,但使用常量-64,即额外空间的高度.我不知道为什么.
                  2. 添加一个空的 UIImageView 作为 UIScrollView 的兄弟,并将其约束为与根视图的所有四个边齐平.
                  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.

                  希望这只是 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 以来使用自动布局和滚动视图的额外顶部空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:带有 ContentInset 的 UICollectionView 不会一直向下滚动 下一篇:调用 layoutIfNeeded() 时 AutoLayout 会破坏约束

                  相关文章

                    <bdo id='ukdMf'></bdo><ul id='ukdMf'></ul>

                    <small id='ukdMf'></small><noframes id='ukdMf'>

                      <tfoot id='ukdMf'></tfoot>
                      <i id='ukdMf'><tr id='ukdMf'><dt id='ukdMf'><q id='ukdMf'><span id='ukdMf'><b id='ukdMf'><form id='ukdMf'><ins id='ukdMf'></ins><ul id='ukdMf'></ul><sub id='ukdMf'></sub></form><legend id='ukdMf'></legend><bdo id='ukdMf'><pre id='ukdMf'><center id='ukdMf'></center></pre></bdo></b><th id='ukdMf'></th></span></q></dt></tr></i><div id='ukdMf'><tfoot id='ukdMf'></tfoot><dl id='ukdMf'><fieldset id='ukdMf'></fieldset></dl></div>
                      <legend id='ukdMf'><style id='ukdMf'><dir id='ukdMf'><q id='ukdMf'></q></dir></style></legend>