Automatic Preferred Max Layout Width before iOS8.0

项目中出现这个警告”Automatic Preferred Max Layout Width before iOS8.0”。


Automatic Preferred Max Layout Width before iOS8.0_第1张图片

出现这个问题一般是在项目的xib文件(或storyboard中),这是Label的一个属性导致的. 这个警告对应的属性为preferredMaxLayoutWidth,这个属性的作用如下:

This property affects the size of the label when layout constraints are applied to it. During layout, if the text extends beyond the width specified by this property, the additional text is flowed to one or more new lines, thereby increasing the height of the label.

对于单行的label,这个属性不用设置,无效.(但是在xib中,当项目部署版本为7.0的话,解决警告,依旧需要点选Explicit).如图


Automatic Preferred Max Layout Width before iOS8.0_第2张图片

出现这个警告的原因一般是因为项目的部署版本为7.0,但是label又没有勾选Explicit导致的,警告的意思即自动偏好宽度在8.0以前不适用,因此对于部署在7.0的项目,应该勾选.

参考文档

你可能感兴趣的:(Automatic Preferred Max Layout Width before iOS8.0)