大小写切换改为仅刷新当前字母显示,不再重置整个页面

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 22:35:26 +08:00
parent 2d8caf3550
commit d14ae41706
@@ -425,7 +425,15 @@ final class QuizViewController: UIViewController {
isUppercase.toggle() isUppercase.toggle()
UserDefaults.standard.set(isUppercase, forKey: "spelling_uppercase") UserDefaults.standard.set(isUppercase, forKey: "spelling_uppercase")
updateCaseButton() updateCaseButton()
restart() selectedOption = nil
let words = config.words.map { word in
let text = isUppercase ? word.word.uppercased() : word.word.lowercased()
return Word(categoryId: word.categoryId, word: text, phonetic: word.phonetic,
meaning: word.meaning, example: word.example, exampleMeaning: word.exampleMeaning)
}
questions = QuizGenerator.makeQuestions(mode: config.mode, words: words)
showQuestion()
spellingView.activate()
} }
private func updateCaseButton() { private func updateCaseButton() {