修复大小写切换后新输入字母不跟随转换,输入时根据当前大小写状态存储
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -218,6 +218,7 @@ final class QuizViewController: UIViewController {
|
||||
|
||||
if isSpelling {
|
||||
spellingHintLabel.text = "\(question.word.word.count) 个字母,补全空缺部分"
|
||||
spellingView.isUppercase = isUppercase
|
||||
spellingView.configure(blankedWord: question.blankedWord, blankPositions: question.blankPositions)
|
||||
if config.isStudyMode {
|
||||
nextButton.isHidden = true
|
||||
@@ -425,6 +426,7 @@ final class QuizViewController: UIViewController {
|
||||
isUppercase.toggle()
|
||||
UserDefaults.standard.set(isUppercase, forKey: "spelling_uppercase")
|
||||
updateCaseButton()
|
||||
spellingView.isUppercase = isUppercase
|
||||
questions = QuizGenerator.recase(questions, toUpper: isUppercase)
|
||||
spellingView.updateCase(toUpper: isUppercase)
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ final class SpellingInputView: UIView, UITextFieldDelegate {
|
||||
private var cursorView: UIView?
|
||||
private var inputEnabled = true
|
||||
|
||||
var isUppercase = false
|
||||
|
||||
var isComplete: Bool {
|
||||
!filledBlanks.isEmpty && filledBlanks.allSatisfy { !$0.isEmpty }
|
||||
}
|
||||
@@ -183,7 +185,8 @@ final class SpellingInputView: UIView, UITextFieldDelegate {
|
||||
onChange?()
|
||||
}
|
||||
} else if let char = string.last, char.isLetter, cursorIndex < blankPositions.count {
|
||||
filledBlanks[cursorIndex] = String(char).lowercased()
|
||||
let converted = isUppercase ? char.uppercased() : char.lowercased()
|
||||
filledBlanks[cursorIndex] = converted
|
||||
cursorIndex += 1
|
||||
refreshBoxes()
|
||||
popBox(atBlank: cursorIndex - 1)
|
||||
|
||||
Reference in New Issue
Block a user