• <small id='6eBFA'></small><noframes id='6eBFA'>

  • <legend id='6eBFA'><style id='6eBFA'><dir id='6eBFA'><q id='6eBFA'></q></dir></style></legend>

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

        <tfoot id='6eBFA'></tfoot>

      1. 不遵守 UITableViewCell contentView 的 AutoLayout 约束

        AutoLayout constraints to UITableViewCell contentView not respected(不遵守 UITableViewCell contentView 的 AutoLayout 约束)

                  <tbody id='odWaL'></tbody>
                <tfoot id='odWaL'></tfoot>
                  <bdo id='odWaL'></bdo><ul id='odWaL'></ul>

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

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

                  <legend id='odWaL'><style id='odWaL'><dir id='odWaL'><q id='odWaL'></q></dir></style></legend>
                  本文介绍了不遵守 UITableViewCell contentView 的 AutoLayout 约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I'm trying to create dynamically resizing table view cells. I accomplished the resizing by using this answer, which is very detailed and helpful.

                  However, the maximum width for the label is not being calculated correctly inheightForRowAtIndexPath.

                  My cell currently only has one label in itscontentView, with constraints set to pin all the label edges to thecontentView edges. Here's what I have in IB

                  The cell size is being calculated with an offscreen cell inheightForRowAtIndexPath using

                  CGSize size = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
                  

                  During this process, it seems like it's honoring the constraints, and the label.preferredMaxLayoutWidth property is being set to 320, but when the label actually gets rendered, there is still padding.

                  解决方案

                  The paddings is layout margins. You have to be beware of Constrain to margins option.

                  Constrain to margins is Enabled:

                  Constrain to margins is Disabled:

                  How to disable it?

                  1. You can double-click the one of constrains and unchecking the Relative to margin option:


                  1. Unchecking the Constrain to margins while creating the constraints of the label:

                  Related link:
                  What is "Constrain to margin" in Storyboard in Xcode 6

                  这篇关于不遵守 UITableViewCell contentView 的 AutoLayout 约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='j5ptY'><style id='j5ptY'><dir id='j5ptY'><q id='j5ptY'></q></dir></style></legend>

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

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

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