我有一个应用程序,它将iOS 8作为开发目标,并使用Interface Builder中的自动布局来定位视图。在iOS 8下运行时,所有UI都正确呈现,而控制台输出中不会抛出任何错误。
在iOS 9下,从左到右的语言,应用程序也按预期运行。但是当我将语言环境更改为从右到左的语言时,UI会出现意外行为,同时也会在控制台中引发冲突的约束错误。
我怀疑这个问题与领先和尾随约束有关,但我找不到正确的解决方法。
这是iOS 9上的控制台输出
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x15c5f2270 UILabel:0x15d80bd30'Buy'.centerX == CurrencyListSectionHeader:0x15d8b1550.centerX>",
"<NSLayoutConstraint:0x15c740090 H:[UILabel:0x15d8858f0'Sell']-(20)-| (Names: '|':CurrencyListSectionHeader:0x15d8b1550 )>",
"<NSLayoutConstraint:0x15c7a0e50 H:[UILabel:0x15d80bd30'Buy']-(NSSpace(8))-[UILabel:0x15d8858f0'Sell']>",
"<NSLayoutConstraint:0x15c79ebc0 'UIView-Encapsulated-Layout-Width' H:[CurrencyListSectionHeader:0x15d8b1550(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x15c7a0e50 H:[UILabel:0x15d80bd30'Buy']-(NSSpace(8))-[UILabel:0x15d8858f0'Sell']>