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

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

    2. <legend id='BNwP8'><style id='BNwP8'><dir id='BNwP8'><q id='BNwP8'></q></dir></style></legend>

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

      1. 自动首选最大布局宽度在 8.0 之前的 iOS 版本中不可用

        时间:2023-09-11

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

              <legend id='dXAGu'><style id='dXAGu'><dir id='dXAGu'><q id='dXAGu'></q></dir></style></legend>
                <tbody id='dXAGu'></tbody>

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

                  <bdo id='dXAGu'></bdo><ul id='dXAGu'></ul>
                • <tfoot id='dXAGu'></tfoot>
                • 本文介绍了自动首选最大布局宽度在 8.0 之前的 iOS 版本中不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我用 Xcode6 beta6 打开了一个现有的 iOS 项目,Xcode 为 Storyboard 和 Xib 文件列出了以下警告:

                  I opened an existing iOS project with Xcode6 beta6, and Xcode lists the following warning for both Storyboard and Xib files:

                  自动首选最大布局宽度在 iOS 版本上不可用8.0之前

                  Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0

                  我尝试通过将宽度设置为如下所示来解决警告:

                  I tried addressing the warning by setting the width as explicit like below:

                  但这并没有解决警告.如何删除它们?

                  Yet this didn't resolve the warnings. How can they be removed?

                  推荐答案

                  更新3:
                  如果您的部署目标设置为 7.1,则将 numberOfLines 设置为除 1 以外的任何值的标签也可能会触发此警告.这完全可以通过新的单视图项目重现.

                  Update 3:
                  This warning can also be triggered by labels that have numberOfLines set to anything but 1 if your deployment target is set to 7.1. This is completely reproducible with new single-view project.

                  复制步骤:

                  1. 创建一个新的单视图、objective-c 项目
                  2. 将部署目标设置为 7.1
                  3. 打开项目的故事板
                  4. 将标签放到提供的视图控制器上
                  5. 将该标签的 numberOfLines 设置为 2.
                  6. 编译

                  我已提交以下雷达:
                  rdar://problem/18700567

                  I've filed the following radar:
                  rdar://problem/18700567

                  更新 2:
                  不幸的是,这在 Xcode 6 的发布版本中再次出现.请注意,在大多数情况下,您可以手动编辑故事板/xib 来解决问题.根据以下评论中的 Charles A.:

                  值得一提的是,你很容易不小心引入此警告,警告本身无助于查找罪魁祸首的标签.这在复杂的情况下是不幸的故事板.您可以将故事板作为源文件打开并搜索使用正则表达式 <label(?!.*preferredMaxLayoutWidth) 查找标签省略 preferredMaxLayoutWidth 属性/值.如果你添加在这样的行中,preferredMaxLayoutWidth="0" 与标记相同显式并将值设置为 0.

                  It's worth mentioning that you can pretty easily accidentally introduce this warning, and the warning itself doesn't help in finding the label that is the culprit. This is unfortunate in a complex storyboard. You can open the storyboard as a source file and search with the regex <label(?!.*preferredMaxLayoutWidth) to find labels that omit a preferredMaxLayoutWidth attribute/value. If you add in preferredMaxLayoutWidth="0" on such lines, it is the same as marking explicit and setting the value 0.

                  更新 1:
                  此错误现已在 Xcode 6 GM 中修复.

                  Update 1:
                  This bug has now been fixed in Xcode 6 GM.

                  原答案
                  这是 Xcode6-Beta6 和 XCode6-Beta7 中的一个错误,现在可以放心地忽略.

                  Original Answer
                  This is a bug in Xcode6-Beta6 and XCode6-Beta7 and can be safely ignored for now.

                  Apple 开发者论坛中的一位 Apple 工程师 this 谈到了这个错误:

                  An Apple engineer in the Apple Developer forums had this to say about the bug:

                  首选最大布局宽度是 UILabel 上的一个自动布局属性,允许它自动垂直增长以适应其内容.6.0 之前的 Xcode 版本将设置 preferredMaxLayoutWidth 为在设计时将多行标签设置为当前边界大小.你会如果您需要在运行时手动更新 preferredMaxLayoutWidth横向布局已更改.

                  Preferred max layout width is an auto layout property on UILabel that allows it to automatically grow vertically to fit its content. Versions of Xcode prior to 6.0 would set preferredMaxLayoutWidth for multiline labels to the current bounds size at design time. You would need to manually update preferredMaxLayoutWidth at runtime if your horizontal layout changed.

                  iOS 8 增加了对自动计算的支持运行时的preferredMaxLayoutWidth,这使得创建多行标签更容易.此设置不向后兼容 iOS7. 为了同时支持 iOS 7 和 iOS 8,Xcode 6 允许您在大小中为 preferredMaxLayoutWidth 选择自动"或显式"检查员.你应该:

                  iOS 8 added support for automatically computing preferredMaxLayoutWidth at runtime, which makes creating multiline labels even easier. This setting is not backwards compatible with iOS 7. To support both iOS 7 and iOS 8, Xcode 6 allows you to pick either "Automatic" or "Explicit" for preferredMaxLayoutWidth in the size inspector. You should:

                  如果以 iOS 8 为目标,请选择自动"以获得最佳体验.挑选显式",如果目标是 <iOS 8. 然后您可以输入您想要设置的 preferredMaxLayoutWidth.启用显式"默认为您选中该框时的当前边界大小.

                  Pick "Automatic" if targeting iOS 8 for the best experience. Pick "Explicit" if targeting < iOS 8. You can then enter the value of preferredMaxLayoutWidth you would like set. Enabling "Explicit" defaults to the current bounds size at the time you checked the box.

                  如果 (1) 您使用自动布局,(2)为多行标签设置了自动"[您可以在标签的大小检查器],以及 (3) 您的部署目标 <iOS 8.

                  The warning will appear if (1) you're using auto layout, (2) "Automatic" is set for a multiline label [you can check this in the size inspector for the label], and (3) your deployment target < iOS 8.

                  似乎错误是此警告针对非自动布局出现文件.如果您看到此警告并且未使用自动布局您可以忽略警告.

                  It seems the bug is that this warning appears for non-autolayout documents. If you are seeing this warning and not using auto layout you can ignore the warning.

                  或者,您可以通过使用情节提要或 xib 上的文件检查器来解决此问题,并将Builds for"更改为Builds for iOS 8.0 and later"

                  Alternately, you can work around the issue by using the file inspector on the storyboard or xib in question and change "Builds for" to "Builds for iOS 8.0 and Later"

                  这篇关于自动首选最大布局宽度在 8.0 之前的 iOS 版本中不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用自动布局,如何根据图像使 UIImageView 的大小动态变化? 下一篇:自调整大小的 UITableViewCell 中的多个 UILabel

                  相关文章

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

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