Compare commits

...

5 Commits

Author SHA1 Message Date
fish 9b09e85498 确认按钮文字颜色与导航栏标题一致
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-20 21:53:20 +08:00
fish 8f2152dc18 确认按钮改用 iOS 26 原生 Liquid Glass API
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-20 21:52:07 +08:00
fish 711693f09a 修复确认按钮正常模式下不可见的问题
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-20 21:49:09 +08:00
fish 885f56218e 确认按钮改为 Liquid Glass 风格
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-20 21:47:22 +08:00
fish 36cb048aa1 键盘上方增加确认按钮,点击验证拼写
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-20 21:43:36 +08:00
2 changed files with 31 additions and 0 deletions
@@ -234,6 +234,9 @@ final class QuizViewController: UIViewController {
nextButton.isEnabled = false
nextButton.isHidden = false
}
spellingView.onSubmit = { [weak self] in
self?.primaryButtonTapped()
}
spellingView.activate()
} else if isDictation {
dictationView.reset()
@@ -2,6 +2,7 @@ import UIKit
final class SpellingInputView: UIView, UITextFieldDelegate {
var onChange: (() -> Void)?
var onSubmit: (() -> Void)?
private let hiddenField = UITextField()
private let stack = UIStackView()
@@ -56,6 +57,33 @@ final class SpellingInputView: UIView, UITextFieldDelegate {
hiddenField.frame = .zero
addSubview(hiddenField)
let accessory = UIView()
accessory.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 52)
accessory.backgroundColor = .clear
var glassConfig = UIButton.Configuration.glass()
glassConfig.title = "确认"
glassConfig.cornerStyle = .fixed
glassConfig.baseForegroundColor = .label
glassConfig.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in
var outgoing = incoming
outgoing.font = .systemFont(ofSize: 16, weight: .semibold)
return outgoing
}
let glassButton = UIButton(configuration: glassConfig)
glassButton.addAction(UIAction { [weak self] _ in
self?.onSubmit?()
}, for: .touchUpInside)
glassButton.translatesAutoresizingMaskIntoConstraints = false
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)
])
hiddenField.inputAccessoryView = accessory
addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(reactivate)))
}