如何解决选择 UITextField 时出现 Swift 键盘错误
我创建了一个常规的 UITextFiled
,如下所示:
self.view.addSubview(userName)
userName.translatesAutoresizingMaskIntoConstraints = false
userName.topAnchor.constraint(equalTo: nameLabel.topAnchor).isActive = true
userName.leadingAnchor.constraint(equalTo: nameLabel.trailingAnchor).isActive = true
userName.heightAnchor.constraint(equalTo: nameLabel.heightAnchor,constant: 0).isActive = true
userName.widthAnchor.constraint(equalTo: view.widthAnchor,multiplier: 0.5).isActive = true
userName.textColor = .black
选择 UITextFiled
时,键盘按预期显示,但出现以下错误。我做了什么?这只是一个简单的 UITextField
。究竟是什么问题?
2021-01-16 19:29:50.826058-0600 AIP[15001:6410326] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand,refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x281c8a170 h=--& v=--& _UIbuttonbarButton:0x133059600.height == 0 (active)>","<NSLayoutConstraint:0x281c89630 _UIUCBKBSelectionBackground:0x133059f20.bottom == _UIbuttonbarButton:0x133059600.bottom - 6 (active)>","<NSLayoutConstraint:0x281c89590 V:|-(6)-[_UIUCBKBSelectionBackground:0x133059f20] (active,names: '|':_UIbuttonbarButton:0x133059600 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x281c89630 _UIUCBKBSelectionBackground:0x133059f20.bottom == _UIbuttonbarButton:0x133059600.bottom - 6 (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.
2021-01-16 19:29:50.826729-0600 AIP[15001:6410326] [LayoutConstraints] Unable to simultaneously satisfy constraints.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。