<legend id='sYA4y'><style id='sYA4y'><dir id='sYA4y'><q id='sYA4y'></q></dir></style></legend>

        <bdo id='sYA4y'></bdo><ul id='sYA4y'></ul>
      1. <small id='sYA4y'></small><noframes id='sYA4y'>

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

      3. UITableView 的自动布局错误

        Autolayout Error with UITableView(UITableView 的自动布局错误)
        <legend id='BtLw8'><style id='BtLw8'><dir id='BtLw8'><q id='BtLw8'></q></dir></style></legend>
        <i id='BtLw8'><tr id='BtLw8'><dt id='BtLw8'><q id='BtLw8'><span id='BtLw8'><b id='BtLw8'><form id='BtLw8'><ins id='BtLw8'></ins><ul id='BtLw8'></ul><sub id='BtLw8'></sub></form><legend id='BtLw8'></legend><bdo id='BtLw8'><pre id='BtLw8'><center id='BtLw8'></center></pre></bdo></b><th id='BtLw8'></th></span></q></dt></tr></i><div id='BtLw8'><tfoot id='BtLw8'></tfoot><dl id='BtLw8'><fieldset id='BtLw8'></fieldset></dl></div>

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

            <tbody id='BtLw8'></tbody>

          • <bdo id='BtLw8'></bdo><ul id='BtLw8'></ul>
            1. <tfoot id='BtLw8'></tfoot>

                • 本文介绍了UITableView 的自动布局错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 TableView,我使用委托方法 tableView:heightForRowAtIndexPath: 指定每个单元格的高度.

                  I have a TableView and I specify the height for each cell using the delegate method tableView:heightForRowAtIndexPath:.

                  当我旋转视图时,我得到了这个我不太理解的错误.

                  When I rotate the view I get this error that I don't quite understand.

                  它不能满足下面的约束并打破它继续.

                  It can't satisfy the constraint below and breaks it to continue.

                  "<_UIScrollViewAutomaticContentSizeConstraint:0x8e8d040 UITableView:0x9423400.contentHeight{id: 213} == -1568.000000>"
                  

                  有谁知道发生了什么以及我为什么要打破这个限制?

                  Does anyone know what is happening and why I'm breaking this constraint?

                  推荐答案

                  更新:这个问题在 iOS 8 中不再相关,它增加了对自调整单元格的支持.不过,它仍然适用于 iOS 7.

                  UPDATE: This issue is no longer relevant in iOS 8, which adds support for self-sizing cells. It is still relevant for iOS 7 however.

                  原始答案(iOS 7):

                  Greg 的回答肯定对我有用 - 我需要调试我的 tableView:estimatedHeightForRowAtIndexPath: 方法.我做了一些调试和一些快速实验,以下是我学到的一些东西:

                  Greg's answer definitely worked for me - I needed to debug my tableView:estimatedHeightForRowAtIndexPath: method. I did some debugging and some quick experiments and here are some things I learned:

                  1. 不要在估计的 row 方法中使用 UITableViewAutomaticDimension.此常量用于页眉和页脚方法.我想我在阅读文档时没有给予足够的关注 :) 更新:UITableViewAutomaticDimension 现在可用于 iOS 8 中的行高,这是自调整单元格功能的一部分.

                  1. Don't use UITableViewAutomaticDimension in the estimated row methods. This constant is for the header and footer methods. I guess I wasn't paying enough attention when I read the documentation :) UPDATE: UITableViewAutomaticDimension can now be used for row heights in iOS 8, part of the self-sizing cells functionality.

                  估计行高为 1.0 会导致异常:NSInternalInconsistencyException",原因:'table view row height must not be negative...'"估计小于 1.0 也会产生奇怪的结果.

                  Estimating row height of 1.0 results in an exception: "NSInternalInconsistencyException', reason: 'table view row height must not be negative...'" Estimating less than 1.0 has strange results as well.

                  在 2.0 和实际之间进行估算可以正常工作,没有任何例外(尽管出于优化原因,2.0 可能是一个不好的选择 - 您希望尽可能接近实际).

                  Estimating between 2.0 and the actual works just fine without any exceptions (although 2.0 is probably a bad choice for optimization reasons - you want to be as close to actual as possible).

                  仅当估计行高大于实际行高时,才会出现约束异常.越接近实际,异常发生的可能性就越小.在获得异常之前您的估计可能有多远似乎与几个不同的因素有关:实际行高、行的位置等.

                  The constraint exception only occurs when the estimated row height is greater than the actual row height. The closer you are to the actual, the less likely the exception will occur. How far off your estimate can be before getting the exception seems to be related to several different factors: actual row height, the position of the row, etc.

                  这篇关于UITableView 的自动布局错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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屋-程序员

                    <tbody id='ULRp7'></tbody>

                  <tfoot id='ULRp7'></tfoot>
                    <legend id='ULRp7'><style id='ULRp7'><dir id='ULRp7'><q id='ULRp7'></q></dir></style></legend>
                      <bdo id='ULRp7'></bdo><ul id='ULRp7'></ul>

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

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