• <legend id='FsjeB'><style id='FsjeB'><dir id='FsjeB'><q id='FsjeB'></q></dir></style></legend>

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

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

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

      <tfoot id='FsjeB'></tfoot>
      1. 视图出现后应用的 iOS 8/XCode 6 自动布局约束

        iOS 8 / XCode 6 autolayout constraints applied after view appears(视图出现后应用的 iOS 8/XCode 6 自动布局约束)

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

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

          2. <tfoot id='xhrZg'></tfoot>
              <bdo id='xhrZg'></bdo><ul id='xhrZg'></ul>
                    <tbody id='xhrZg'></tbody>

                  本文介绍了视图出现后应用的 iOS 8/XCode 6 自动布局约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I have a project that was working just fine with XCode 5 and iOS 7, but when I recently downloaded XCode 6, I noticed some weird behavior with autolayout.

                  I have a storyboard with a view that just has a UIImageView and two UILabels. This view gets loaded using a UiPageViewController. The UIImageView is centered horizontally and vertically in the view and there are constraints specifying the distance of the two labels from the image view. When there is a case when the storyboard and autolayout values conflict (for example, in the storyboard, one label is 20 pixels above the image view but the autolayout says it should be 40 pixels above), it used to be that the autolayout value was successfully applied before the view loaded. Thus, when the view gets shown for the first time, everything is in the right place.

                  Now with iOS 8 / XCode 6, I'm seeing that the view loads and then things jump to their final autolayout position. This jump is noticeable to the end user both in the simulator and on a real device, and it's really annoying. Is there a way to go back to the old behavior? As far as I'm aware, no code has changed to cause this issue.

                  解决方案

                  Where is your code that is making changes to your constraints?

                  If you're keeping it in viewWillAppear: you will have that problem. I found that viewDidLayoutSubviews works well for iOS8 but not always for iOS7 backwards.

                  Eventually, if you cant use viewDidLayoutSubviews, what I'd suggest is hide the container view in viewDidLoad and unhide it in viewWillAppear, only after the constraints have been applied. It gets you a small extra delay when loading the screen but the constraints change gets transparent to the user.

                  这篇关于视图出现后应用的 iOS 8/XCode 6 自动布局约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  iOS AutoLayout - get frame size width(iOS AutoLayout - 获取帧大小宽度)
                  Auto layout constraints issue on iOS7 in UITableViewCell(UITableViewCell中iOS7上的自动布局约束问题)
                  How to resize superview to fit all subviews with autolayout?(如何调整超级视图的大小以适应所有具有自动布局的子视图?)
                  Springs in Auto Layout: Distribute views evenly, with constraints, in Xcode 5(自动布局中的弹簧:在 Xcode 5 中使用约束均匀分布视图)
                  reloadData() of UITableView with Dynamic cell heights causes jumpy scrolling(具有动态单元格高度的 UITableView 的 reloadData() 导致跳跃滚动)
                  What is NSLayoutConstraint quot;UIView-Encapsulated-Layout-Heightquot; and how should I go about forcing it to recalculate cleanly?(什么是 NSLayoutConstraint“UIView-Encapsulated-Layout-Height?我应该如何强制它干净地重新计算?) - IT屋-程序员

                  1. <small id='Hg1rL'></small><noframes id='Hg1rL'>

                        <bdo id='Hg1rL'></bdo><ul id='Hg1rL'></ul>
                      • <tfoot id='Hg1rL'></tfoot>

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