gpt4 book ai didi

ios - PencilKit 无法同时满足约束

转载 作者:行者123 更新时间:2023-11-30 10:27:04 30 4
gpt4 key购买 nike

我正在尝试实现出现在屏幕底部的铅笔套件工具包(一支铅笔、橡皮擦等)。但是,运行这行代码后:

guard let window = view.window, let toolPicker = PKToolPicker.shared(for: window)
else {return}

我在日志中收到以下错误,并且工具选择器未出现:

    PDF Reader[926:85385] [LayoutConstraints] 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.
(
"<NSLayoutConstraint:0x60000191d450 UIView:0x7fdfb7376ff0.height == 75 (active)>",
"<NSLayoutConstraint:0x60000191d4a0 V:|-(0)-[UIView:0x7fdfb7376ff0] (active, names: '|':PKPaletteContainerView:0x7fdfb737b7e0 )>",
"<NSLayoutConstraint:0x60000191dae0 V:|-(0)-[PKPaletteContainerView:0x7fdfb737b7e0] (active, names: '|':UIView:0x7fdfb46181d0 )>",
"<NSLayoutConstraint:0x60000191dc70 PKPaletteContainerView:0x7fdfb737b7e0.bottom == UIView:0x7fdfb46181d0.bottom (active)>",
"<NSLayoutConstraint:0x600001901ea0 V:|-(0)-[UIView:0x7fdfb46181d0] (active, names: '|':PKPaletteView:0x7fdfb462d3e0 )>",
"<NSLayoutConstraint:0x600001901ef0 UIView:0x7fdfb46181d0.bottom == PKPaletteView:0x7fdfb462d3e0.bottom (active)>",
"<NSLayoutConstraint:0x6000019fcf00 PKPaletteView:0x7fdfb462d3e0.height == 122 (active)>",
"<NSLayoutConstraint:0x60000191d720 UIView:0x7fdfb7376ff0.bottom == PKPaletteContainerView:0x7fdfb737b7e0.bottom (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000191d450 UIView:0x7fdfb7376ff0.height == 75 (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

我不太确定如何处理 PKPalette 的约束或下面哪些约束发生冲突。我还尝试禁用translatesAutoResizingMaskIntoConstraints,但它不起作用,因为我的应用程序的其他部分依赖于它。感谢任何帮助,谢谢!

最佳答案

在 iPhone 上调用 PKToolPicker 时,我收到相同的日志消息。在 iPad 上,我没有遇到约束错误。如果我查看约束冲突,这一切似乎都是 PKToolPicker 内部的,与我的布局设置无关。

如果您运行相同的代码,但 iPhone 处于横向而不是纵向,则不会发生冲突。因此,我怀疑 PKPickerTool 约束存在某种限制,当屏幕宽度太窄时,Apple 需要修复这些限制。我会发布雷达。

关于ios - PencilKit 无法同时满足约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59961602/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com