From 7e627df952410b39a9a81dce31667f2d630ab191 Mon Sep 17 00:00:00 2001 From: fish Date: Sun, 19 Jul 2026 22:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E8=AF=8D=E5=88=97=E8=A1=A8=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E8=AF=A6=E6=83=85=E9=A1=B5=E5=A2=9E=E5=8A=A0=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E6=94=BE=E5=A4=A7=E8=BF=87=E6=B8=A1=E5=8A=A8=E7=94=BB?= 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/WordCardCell.swift | 2 ++ .../LearnEnglish/Views/WordListViewController.swift | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/LearnEnglish/LearnEnglish/Views/WordCardCell.swift b/LearnEnglish/LearnEnglish/Views/WordCardCell.swift index b3d6b3f..96db8c2 100644 --- a/LearnEnglish/LearnEnglish/Views/WordCardCell.swift +++ b/LearnEnglish/LearnEnglish/Views/WordCardCell.swift @@ -10,6 +10,8 @@ final class WordCardCell: UITableViewCell { var onSpeak: ((Word) -> Void)? + var zoomSourceView: UIView { cardView } + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) backgroundColor = .clear diff --git a/LearnEnglish/LearnEnglish/Views/WordListViewController.swift b/LearnEnglish/LearnEnglish/Views/WordListViewController.swift index 597ff57..8ef165c 100644 --- a/LearnEnglish/LearnEnglish/Views/WordListViewController.swift +++ b/LearnEnglish/LearnEnglish/Views/WordListViewController.swift @@ -147,7 +147,15 @@ extension WordListViewController: UITableViewDataSource, UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { Haptics.selection() - navigationController?.pushViewController( - WordDetailViewController(word: category.words[indexPath.row], categoryName: category.name), animated: true) + let detail = WordDetailViewController(word: category.words[indexPath.row], categoryName: category.name) + detail.preferredTransition = .zoom(options: .init()) { [weak self] _ in + guard let self else { return nil } + if self.tableView.cellForRow(at: indexPath) == nil { + self.tableView.scrollToRow(at: indexPath, at: .middle, animated: false) + self.tableView.layoutIfNeeded() + } + return (self.tableView.cellForRow(at: indexPath) as? WordCardCell)?.zoomSourceView + } + navigationController?.pushViewController(detail, animated: true) } }