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?

        时间:2023-09-10
          <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 自动布局:相等的空间以适应超级视图的宽度 下一篇:纵向和横向模式下的不同布局

                  相关文章

                  <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>

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

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