1. <legend id='EyokR'><style id='EyokR'><dir id='EyokR'><q id='EyokR'></q></dir></style></legend>

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

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

        为什么多次调用 viewDidLayoutSubviews?

        Why is viewDidLayoutSubviews called multiple times?(为什么多次调用 viewDidLayoutSubviews?)
          <tbody id='rqdmA'></tbody>
        <legend id='rqdmA'><style id='rqdmA'><dir id='rqdmA'><q id='rqdmA'></q></dir></style></legend>

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

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

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

                  本文介绍了为什么多次调用 viewDidLayoutSubviews?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 Swift 开发 iOS 通用应用程序,使用自动布局并且仅支持纵向.

                  I'm developing iOS Universal App with Swift, using auto layout and support only portrait.

                  我发现 UIViewController.viewDidLayoutSubviews 被调用了多次.相反,viewDidLoad 仅在启动 MyApp 的 UIViewController 时调用一次.

                  I found UIViewController.viewDidLayoutSubviews called multiple times. Instead, viewDidLoad is only called once on starting up MyApp's UIViewController.

                  为什么会多次调用viewDidLayoutSubviews?每个UIView(UIButtonsUITextFields等)的约束会按顺序执行吗?

                  Why is viewDidLayoutSubviews called multiple times? Will constraints on each UIView (UIButtons,UITextFields, etc..) be performed in order?

                  任何信息将不胜感激.

                  推荐答案

                  LoadView 只调用一次:当需要加载视图时.

                  LoadView is only called once: when the view needs to be loaded.

                  LayoutSubviews 在任何调用了 setNeedsLayoutsetNeedsDisplayInRect 的视图上,每次运行循环都会调用一次 - 这包括任何时候视图中添加了子视图,可以滚动、调整大小等.

                  LayoutSubviews, however, is called once per run loop on any view that has had setNeedsLayout or setNeedsDisplayInRect called on it - this includes whenever a subview has been added to the view, scrolling, resizing, etc.

                  这篇关于为什么多次调用 viewDidLayoutSubviews?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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屋-程序员
                  <legend id='p6skG'><style id='p6skG'><dir id='p6skG'><q id='p6skG'></q></dir></style></legend>

                • <tfoot id='p6skG'></tfoot>

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

                        <tbody id='p6skG'></tbody>
                          <bdo id='p6skG'></bdo><ul id='p6skG'></ul>

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