Xcode关于警告AutomaticPreferredMaxLayoutWidth的消除方法

简介:

Xcode关于警告AutomaticPreferredMaxLayoutWidth的消除方法

     在iOS开发中,如果使用到了storyboard与xib文件并且使用autolayout进行自动布局,有时会报出Automatic Preferred Max Layout Width before iOS8.0的警告。工程中如果兼容的iOS版本为iOS8.0一下,并且使用了多行UILabel控件,往往在autolayout自动布局时会出现上述警告,上述警告的主要原因是在iOS8.0后系统会自动计算多行UILabel控件的理想换行宽度,iOS8以下则不会,需要开发者手动设置一个确定的值。

    解决方案如下,找到xib或storyboard中的多行UILabel控件,勾选Explicit属性,设置为一个固定的值,例如0。如下图所示:

151709_shq0_2340880.png

之后上述警告即可消除,事实上,使用了autolayout后,这个属性并没有任何效果,仅仅为了消除警告,直接设置为0即可。


目录
相关文章
|
iOS开发
Xcode报错解决方法:ld: symbol(s) not found for architecture arm64
Xcode报错解决方法:ld: symbol(s) not found for architecture arm64
2427 0
|
11月前
|
iOS开发
查看Xcode安装进度方法
查看Xcode安装进度方法
217 0
|
11月前
|
缓存 iOS开发 索引
Xcode清理缓存方法
Xcode清理缓存方法
144 0
|
编译器 开发工具 iOS开发
去掉Xcode工程中的某种类型的警告
在我们的项目中,通常使用了大量的第三方代码,这些代码可能很复杂,我们不敢改动他们,可是作者已经停止更新了
129 0
|
C++ iOS开发
iOS开发 -- 在Xcode中引入cpp文件,并调用cpp文件中的方法
iOS开发 -- 在Xcode中引入cpp文件,并调用cpp文件中的方法
640 0
iOS开发 -- 在Xcode中引入cpp文件,并调用cpp文件中的方法
|
iOS开发
忽略 Xcode 8 中的注释警告
从Xcode8.0开始,引入了文档注释警告,虽然是件好事,可是各种三方库爆出了一大堆警告:
59 0
|
iOS开发
Xcode警告消除 ios WKWebView Could not signal service com.apple.WebKit.WebContent
Xcode警告消除 ios WKWebView Could not signal service com.apple.WebKit.WebContent
347 0
|
iOS开发
Xcode警告 XIB Setting the background color on UITableViewHeaderFooterView has been deprecated. Plea...
Xcode警告 XIB Setting the background color on UITableViewHeaderFooterView has been deprecated. Plea...
84 0
|
iOS开发
Xcode消除警告:Unknown class ViewController in Interface Builder file
Xcode消除警告:Unknown class ViewController in Interface Builder file
235 0
|
iOS开发
Xcode消除警告:-1: The iOS Simulator deployment target is set to 6.0, but the range of supported deplo...
Xcode消除警告:-1: The iOS Simulator deployment target is set to 6.0, but the range of supported deplo...
131 0
Xcode消除警告:-1: The iOS Simulator deployment target is set to 6.0, but the range of supported deplo...