调整确认按钮尺寸、圆角、键盘间距,支持横竖屏适配
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -58,12 +58,14 @@ final class SpellingInputView: UIView, UITextFieldDelegate {
|
||||
addSubview(hiddenField)
|
||||
|
||||
let accessory = UIView()
|
||||
accessory.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 52)
|
||||
accessory.frame = CGRect(x: 0, y: 0, width: 0, height: 74)
|
||||
accessory.autoresizingMask = .flexibleWidth
|
||||
accessory.backgroundColor = .clear
|
||||
|
||||
var glassConfig = UIButton.Configuration.glass()
|
||||
glassConfig.title = "确认"
|
||||
glassConfig.cornerStyle = .fixed
|
||||
glassConfig.background.cornerRadius = 25
|
||||
glassConfig.baseForegroundColor = .label
|
||||
glassConfig.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in
|
||||
var outgoing = incoming
|
||||
@@ -78,9 +80,9 @@ final class SpellingInputView: UIView, UITextFieldDelegate {
|
||||
accessory.addSubview(glassButton)
|
||||
NSLayoutConstraint.activate([
|
||||
glassButton.trailingAnchor.constraint(equalTo: accessory.trailingAnchor, constant: -15),
|
||||
glassButton.centerYAnchor.constraint(equalTo: accessory.centerYAnchor),
|
||||
glassButton.widthAnchor.constraint(equalToConstant: 60),
|
||||
glassButton.heightAnchor.constraint(equalToConstant: 44)
|
||||
glassButton.topAnchor.constraint(equalTo: accessory.topAnchor, constant: 12),
|
||||
glassButton.widthAnchor.constraint(equalToConstant: 80),
|
||||
glassButton.heightAnchor.constraint(equalToConstant: 50)
|
||||
])
|
||||
hiddenField.inputAccessoryView = accessory
|
||||
|
||||
|
||||
Reference in New Issue
Block a user