我已经实现了自定义键盘。它在运行 iOS 8.2 的设备上运行良好。
但是,当我在 iOS 8.3 的设备上运行相同的代码时,我收到以下警告,并且键盘的高度设置不正确:
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)]>
我不懂这啥意思。请帮我弄清楚。
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)]>
它告诉你它无法同时满足所有约束。
你有一个限制<NSAutoresizingMaskLayoutConstraint:0x15dd1da0 h=-&- v=-&- Keyboard:0x15db2b00.width == UIView:0x15da7b90.width - 320>
,这表明键盘的宽度等于键盘的宽度UIView
at 0x15da7b90
负320(检查调试器是哪一个,我通常会查看GUI调试器,如果我知道是什么UIView
s 可能是导致问题的原因)。
另一个相互冲突的约束是<NSLayoutConstraint:0x15dd2520 'UIView-Encapsulated-Layout-Width' H:[UIView:0x15da7b90(0)]>
,它决定了宽度UIView
at 0x15da7b90
(同上)为0。它不能同时满足这一点和上面的一项,所以破坏了这一点。
我发现你的第一个约束是以下类型之一NSAutoresizingMaskLayoutConstraint
,所以你可以尝试设置setTranslatesAutoresizingMaskIntoConstraints
根据您的观点,将其设置为 false,这可能会消除第一个约束,从而消除冲突。
其他有用的文档:
-
视觉格式语言,Xcode 在日志中使用的格式,有助于了解这种语言以更好地调试它们。
-
在 Xcode 中查看调试,有助于识别哪些视图位于何处以及位于什么地址。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)