详情页移除入场动画、标题显示分类名,汉选英播放按钮选答后才显示

This commit is contained in:
2026-07-18 23:58:50 +08:00
parent c3a4990984
commit def92715ac
3 changed files with 17 additions and 18 deletions
@@ -2,16 +2,17 @@ import UIKit
final class WordDetailViewController: UIViewController {
private let word: Word
private let categoryName: String
private let speech = SpeechService.shared
private let speakButton = UIButton(type: .system)
private let exampleSpeakButton = UIButton(type: .system)
private let contentStack = UIStackView()
private var speechObserver: NSObjectProtocol?
private var didAnimateEntry = false
init(word: Word) {
init(word: Word, categoryName: String = "") {
self.word = word
self.categoryName = categoryName
super.init(nibName: nil, bundle: nil)
}
@@ -27,7 +28,7 @@ final class WordDetailViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
title = word.word
title = categoryName
navigationItem.largeTitleDisplayMode = .never
buildLayout()
updateSpeakState()
@@ -38,14 +39,6 @@ final class WordDetailViewController: UIViewController {
}
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if !didAnimateEntry {
didAnimateEntry = true
contentStack.animateEntry(distance: 16, duration: 0.35)
}
}
private func updateSpeakState() {
let wordSpeaking = speech.isSpeaking(word.word)
speakButton.configuration?.image = UIImage(