iOS Storyboard 布局警告相关说明

这里用来整理记录下一些有关iOS警告发生的原因以及处理的方案. 记性差没办法, 不记录下来, 下次绝对又忘记了, POI~

First baseline layout attribute

错误: warning: Attribute Unavailable: First baseline layout attribute on iOS versions prior to 8.0

原因: iOS7 不支持 firstBaseline 属性

解决方案:

  1. storyboard(右键) -> Option As -> Source Code
  2. firstBaseline 替换成 centerY

Ps: 替换完成, 通常需要进行二次调整

Automatic Preferred Max Layout Width is not available

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

原因: label numberOfLines 设置 大于一, 需要动态计算高, 然而iOS7却不支持

解决方案:

  1. storyboard(右键) -> Option As -> Source Code
  2. numberOfLines=”2” 替换成 numberOfLines=”0”
  3. 然后label加上高度约束

Plain Style unsupported in a Navigation Item

错误: warning: Unsupported Configuration: Plain Style unsupported in a Navigation Item

原因: 设置完UINavigation -> UIBarButtonItem后, 删除UIBarButtonItem后设置成UIView, 之后就会出现这个警告

解决方案:

  1. storyboard(右键) -> Option As -> Source Code

  2. 替换成:

Ps: rightBarButtonItem 类似

Failed to set (Attributrs) user defined inspected property on

错误: Failed to set (Attributrs) user defined inspected property on (UIImageView): [ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key constant.

原因: 通过 show the identity inspector -> User Defined Runtime Attributrs 设置属性时 属性不兼容

解决方案:

找到这个属性修改或删除

Ps: Attributrs 就是在报错是的那个属性名