iOS 8.3版本“的UIView封装,布局宽度”的自定义键盘 [英] iOS 8.3 'UIView-Encapsulated-Layout-Width' in Custom Keyboard
问题描述
我实现了自定义键盘。它工作正常,它运行的iOS 8.2设备上。
然而,当我与iOS 8.3的设备上运行相同的code我得到以下警告和键盘的高度设置不正确:
大概在以下列表中的约束条件中的至少一个是一个你不想要的。试试这个:(1)看一下每个约束和揣摩,你不要指望; (2)找到code,它增加了不必要的约束或限制并修复它。 (注:如果你看到你不明白NSAutoresizingMaskLayoutConstraints,请参阅文档UIView的财产translatesAutoresizingMaskIntoConstraints)
(
< NSAutoresizingMaskLayoutConstraint:0x15dd1da0 H = - &安培; - V = - &安培; - 键盘:0x15db2b00.width ==的UIView:0x15da7b90.width - 320 GT;,
&所述; NSLayoutConstraint:0x15dd2520'的UIView包封-布局宽度1 H:[UIView的:0x15da7b90(0)]>中
)将试图打破约束恢复
< NSLayoutConstraint:0x15dd2520'的UIView封装,布局宽度H:[UIView的:0x15da7b90(0)] GT;
我不知道这意味着什么。请帮我找到答案。
大概在以下列表中的约束条件中的至少一个是一个你不想要的。试试这个:(1)看一下每个约束和揣摩,你不要指望; (2)找到code,它增加了不必要的约束或限制并修复它。 (注:如果你看到你不明白NSAutoresizingMaskLayoutConstraints,请参阅文档UIView的财产translatesAutoresizingMaskIntoConstraints)
(
< NSAutoresizingMaskLayoutConstraint:0x15dd1da0 H = - &安培; - V = - &安培; - 键盘:0x15db2b00.width ==的UIView:0x15da7b90.width - 320 GT;,
&所述; NSLayoutConstraint:0x15dd2520'的UIView包封-布局宽度1 H:[UIView的:0x15da7b90(0)]>中
)将试图打破约束恢复
< NSLayoutConstraint:0x15dd2520'的UIView封装,布局宽度H:[UIView的:0x15da7b90(0)] GT;
这是告诉你,它不能一次满足所有约束。
您有一个约束< NSAutoresizingMaskLayoutConstraint:0x15dd1da0 H = - &安培; - V = - &安培; - 键盘:0x15db2b00.width ==的UIView:0x15da7b90.width - 320 GT;
,这决定了键盘的宽度等于的UIView
在 0x15da7b90
减去320的宽度(检查调试这是其中之一,我通常看GUI调试器,如果我知道是什么的UIView
取值可能导致该问题)。
其他冲突的约束是< NSLayoutConstraint:0x15dd2520'的UIView封装,布局宽度H:[UIView的:0x15da7b90(0)] GT;
,这就决定在的UIView
在 0x15da7b90
宽度(相同)为0,不能同时满足这一个,一以上,因此它打破了这一个。
我看你的第一个约束是类型 NSAutoresizingMaskLayoutConstraint
,所以你可以尝试设置 setTranslatesAutoresizingMaskIntoConstraints
来的一个假你的看法,这可能会删除第一个约束,从而消除冲突。
其他的帮助文档:
- 视觉格式语言,即X code中的日志中使用的格式,有助于了解这种语言,以便更好地进行调试。
- 查看调试以x code ,有助于确定哪些意见在哪里,在什么地址。
I have implemented a custom keyboard. It works fine on a device which runs iOS 8.2.
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.
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).
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.
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.
Other helpful documentation:
- Visual Format Language, the format that Xcode uses in the log, helps to know this language to debug them better.
- View Debugging in Xcode, helps to identify which views are where and at what address.
这篇关于iOS 8.3版本“的UIView封装,布局宽度”的自定义键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!