我已经实现了一个自定义键盘.它在运行 iOS 8.2 的设备上运行良好.
I have implemented a custom keyboard. It works fine on a device which runs iOS 8.2.
但是,当我在装有 iOS 8.3 的设备上运行相同的代码时,我收到以下警告,并且键盘的高度设置不正确:
However, when I run the same code on a device with iOS 8.3 I get the following warnings and the height of the keyboard is not set properly:
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)
(
"<NSAutoresizingMaskLayoutConstraint:0x15dd1da0 h=-&- v=-&- Keyboard:0x15db2b00.width == UIView:0x15da7b90.width - 320>",
"<NSLayoutConstraint:0x15dd2520 'UIView-Encapsulated-Layout-Width' H:[UIView:0x15da7b90(0)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x15dd2520 'UIView-Encapsulated-Layout-Width' H:[UIView:0x15da7b90(0)]>
我不知道这意味着什么.请帮我弄清楚.
I have no idea what this means. Please help me figure it out.
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)
(
"<NSAutoresizingMaskLayoutConstraint:0x15dd1da0 h=-&- v=-&- Keyboard:0x15db2b00.width == UIView:0x15da7b90.width - 320>",
"<NSLayoutConstraint:0x15dd2520 'UIView-Encapsulated-Layout-Width' H:[UIView:0x15da7b90(0)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x15dd2520 'UIView-Encapsulated-Layout-Width' H:[UIView:0x15da7b90(0)]>
它告诉你它不能同时满足所有约束.
It is telling you that it can't satisfy all constraints at once.
您有一个约束 <NSAutoresizingMaskLayoutConstraint:0x15dd1da0 h=-&- v=-&- Keyboard:0x15db2b00.width == UIView:0x15da7b90.width - 320>
,它规定了键盘的宽度等于 0x15da7b90
处的 UIView
的宽度减去 320(检查调试器这是哪一个,如果我知道 UIView
s 可能会导致问题).
You have a constraint <NSAutoresizingMaskLayoutConstraint:0x15dd1da0 h=-&- v=-&- Keyboard:0x15db2b00.width == UIView:0x15da7b90.width - 320>
, which dictates the width of the keyboard equals the width of the UIView
at 0x15da7b90
minus 320 (check the debugger which one this is, I usually look at the GUI debugger if I know what UIView
s might be causing the problem).
另一个冲突的约束是 <NSLayoutConstraint:0x15dd2520 'UIView-Encapsulated-Layout-Width' H:[UIView:0x15da7b90(0)]>
,它规定了 的宽度>UIView
at 0x15da7b90
(同一个)为0.不能同时满足这个和上面那个,所以打破了这个.
The other conflicting constraint is <NSLayoutConstraint:0x15dd2520 'UIView-Encapsulated-Layout-Width' H:[UIView:0x15da7b90(0)]>
, which dictates the width of the UIView
at 0x15da7b90
(same one) to be 0. It cannot satisfy both this one and the one above, so it breaks this one.
我看到您的第一个约束是 NSAutoresizingMaskLayoutConstraint
类型之一,因此您可以尝试在视图上将 setTranslatesAutoresizingMaskIntoConstraints
设置为 false,这可能会删除第一个约束,从而消除冲突.
I see that your first constraint is one of the type NSAutoresizingMaskLayoutConstraint
, so you can try to set setTranslatesAutoresizingMaskIntoConstraints
to false on your view, which will probably remove the first constraint, thus removing the conflict.
其他有用的文档:
这篇关于自定义键盘中的 iOS 8.3 'UIView-Encapsulated-Layout-Width'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!