ios - 通过 UITextFields 约束问题交换
问题描述
我有一个带有表格视图和文本字段的 EditProfileViewController。在其中一个文本字段中,我有一个作为 inputView 的 pickerView 和一个在 inputAccessoryView 中的工具栏。当视图加载并且我选择 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,但我不知道如何解决这个问题。
解决方案
这开始在我的 iOS13 应用程序中发生,我怀疑这是一个错误。在尝试了我能想到的一切之后,我关闭了自动更正并停止遇到约束问题。
textEdit.autocorrectionType = .no
推荐阅读
- mfc - 用图标计算 CComboBoxEx 的最大下拉宽度
- java - 如何从跨度和链接文本中单击元素?
- html - 如果其中一个具有特定类别,则选择所有兄弟姐妹
- javascript - NaN 我第二次按下“按钮”
- xcode10 - 如何使用 PanGestureRecognizer 重新定位子图层?
- phonegap - Phonegap:CLI 升级到 6.5.0 后的 iOS 错误
- apache-flink - 在 EventTime 流环境中绕过 Flink CEP 缓冲区
- python - Python / NiFi:ExecuteScript python,将 UTF-16 文本文件转换为 UTF-8
- c - 打开文件时出现分段错误
- javascript - 轮播不显示使用 Google 库集成上的操作