Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
来源:互联网 发布:php 观察者模式 编辑:程序博客网 时间:2024/04/28 22:06
http://stackoverflow.com/questions/25398312/automatic-preferred-max-layout-width-is-not-available-on-ios-versions-prior-to-8
Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
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.
Steps to Reproduce:
- Create a new single-view, objective-c project
- Set the Deployment Target to 7.1
- Open the project's storyboard
- Drop a label onto the provided view controller
- Set the numberOfLines for that label to 2.
- Compile
I've filed the following radar:
rdar://problem/18700567
Update 2:
Unfortunately, this is a thing again in the release version of Xcode 6. Note that you can, for the most part, manually edit your storyboard/xib to fix the problem. Per Charles A. in the comments below:
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.
Update 1:
This bug has now been fixed in Xcode 6 GM.
Original Answer
This is a bug in Xcode6-Beta6 and XCode6-Beta7 and can be safely ignored for now.
An Apple engineer in the Apple Developer forums had this to say about the bug:
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 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:
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.
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.
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"
- Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- [Xcode] Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- Automatic Preferred Max Layout Width is not available on iOS versions prior to
- iOS自动布局解决警告Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- iOS自动布局解决警告Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- [xcode-warning]Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- XCode自动布局Warning: Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- Attribute Unavailable: Automatic Preferred Max Layout Width is not available on iOS versions prior t
- Attribute Unavailable: Automatic Preferred Max Layout Width is not available on iOS versions prior t
- Attribute Unavailable: Automatic Preferred Max Layout Width is not available on iOS versions prior t
- 警告:Attribute Unavailable Automatic Preferred Max Layout Width is not available on iOS versions pri
- Automatic Preferred Max Layout Width is not available on
- warning: Automatic Preferred Max Layout Width before iOS 8.0
- Automatic Preferred Max Layout Width before iOS 8.0解决办法
- iOS自动布局解决警告Automatic Preferred Max Layout Width before iOS 8.0
- linux上python问题s
- 万能适配器
- open函数--------------详解,flags参数全面
- Subsets
- Oracle数据库11g中 exp/imp与expdp/impdp区别
- Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- Aurora 框架学习记录
- 连除解决乘法溢出
- 计划工作和组织工作
- 各大云服务供应商对初创公司的扶持政策对比
- Eclipse快捷键大全
- Node.Js - 路由Router
- Tomcat CatalinaProperties的loadProperties()方法
- Codeforces551C:GukiZ hates Boxes(二分+贪心)