From c86e482e680d9c35af424bcea488ba83983b5017 Mon Sep 17 00:00:00 2001 From: fish Date: Tue, 21 Jul 2026 22:46:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=A7=E5=B0=8F=E5=86=99?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=90=8E=E6=96=B0=E8=BE=93=E5=85=A5=E5=AD=97?= =?UTF-8?q?=E6=AF=8D=E4=B8=8D=E8=B7=9F=E9=9A=8F=E8=BD=AC=E6=8D=A2=EF=BC=8C?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=97=B6=E6=A0=B9=E6=8D=AE=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=86=99=E7=8A=B6=E6=80=81=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- LearnEnglish/LearnEnglish/Views/QuizViewController.swift | 2 ++ LearnEnglish/LearnEnglish/Views/SpellingInputView.swift | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/LearnEnglish/LearnEnglish/Views/QuizViewController.swift b/LearnEnglish/LearnEnglish/Views/QuizViewController.swift index 026d57f..9132086 100644 --- a/LearnEnglish/LearnEnglish/Views/QuizViewController.swift +++ b/LearnEnglish/LearnEnglish/Views/QuizViewController.swift @@ -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) } diff --git a/LearnEnglish/LearnEnglish/Views/SpellingInputView.swift b/LearnEnglish/LearnEnglish/Views/SpellingInputView.swift index 6b50895..7cc56a3 100644 --- a/LearnEnglish/LearnEnglish/Views/SpellingInputView.swift +++ b/LearnEnglish/LearnEnglish/Views/SpellingInputView.swift @@ -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)