交换UITextFields约束问题

问题描述 投票:0回答:1

我有一个EditProfileViewController,带有一个表视图和文本字段。在一个文本字段中,我有一个pickerView作为inputView,在inputAccessoryView中有一个ToolBar。当视图加载时,我选择firstName文本字段,然后返回并移至lastName文本字段,我收到约束警告。

[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:0x2809a4640 'assistantHeight' TUISystemInputAssistantView:0x1113b11a0.height == 45   (active)>",
"<NSLayoutConstraint:0x2809a0320 'assistantView.bottom' TUISystemInputAssistantView:0x1113b11a0.bottom == _UIKBCompatInputView:0x11a437e80.top   (active)>",
"<NSLayoutConstraint:0x2809a05a0 'assistantView.top' V:|-(0)-[TUISystemInputAssistantView:0x1113b11a0]   (active, names: '|':UIInputSetHostView:0x11d06ce50 )>",
"<NSLayoutConstraint:0x280943840 'inputView.top' V:|-(0)-[_UIKBCompatInputView:0x11a437e80]   (active, names: '|':UIInputSetHostView:0x11d06ce50 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2809a0320 'assistantView.bottom' TUISystemInputAssistantView:0x1113b11a0.bottom == _UIKBCompatInputView:0x11a437e80.top   (active)>

当我在两个默认文本字段之间切换时,会发生这种情况,我不明白为什么。我做了一些研究,从中可以看出这是iOS 13的错误,因为在另一台装有iOS 10的设备上,这没有发生。

要消除此约束问题的解决方法是将autoCorrectionType设置为false。但我想启用此功能。我认为发生这种情况是因为我在countryTextfield的inputView中有一个pickerView,但我不知道如何解决这个问题。

ios uitextfield swift4 uipickerview
1个回答
0
投票

我遇到了同样的问题,我不知道这是否是IOS 13.4的错误?

[LayoutConstraints]无法同时满足约束。以下列表中至少有一个约束是您不想要的约束。尝试这个:(1)查看每个约束,并尝试找出不期望的约束;(2)查找添加了一个或多个不必要约束的代码并进行修复。(“”,“”,“”,“”)

将尝试通过打破约束来恢复

© www.soinside.com 2019 - 2024. All rights reserved.