故事板警告:iOS 8.0 之前的第一个基线布局属性

Storyboard warning : First baseline layout attribute before iOS 8.0

我不知道如何消除这个警告,我正在使用一个包含许多 viewController(带有标签、文本字段和许多约束)的情节提要,所有这些都是以几乎相同的方式创建的。

当我点击警告时,它突出显示了 scrollView 中的 UILabel :

这个 scrollView 有很多带有约束的 UILabel,我尝试了所有我能找到的东西,包括:Attribute Unavailable: First baseline layout attribute on iOS versions prior to 8.0

此警告不会导致我的应用程序崩溃,我已经在模拟器和 iPhone 4 (ios 7.1.2) 上进行了尝试。但是我担心 AppStore 的批准。

我认为问题在于您有许多使用 NSLayoutAttributeFirstBaseline 的约束,当您单击警告时 Xcode 指向错误的约束。

用 "firstBaseline" 在 Xcode 中识别约束搜索。更改所有使用 NSLayoutAttributeFirstBaseline.

的约束

注意:您可能需要调整您的观点。在我的例子中 NSLayoutAttributeBaseline 效果很好。

NSLayoutAttributeFirstBaseline
The object’s baseline. For objects with more than one line of text, this is the baseline for the topmost line of text. The object’s baseline. For objects with more than one line of text, this is the baseline for the topmost line of text. Available in iOS 8.0 and later.

NSLayoutAttributeBaseline
The object’s baseline. The object’s baseline. Available in iOS 6.0 and later.