From 600f47c18dbfb4a516006c9975403b5e35c76a63 Mon Sep 17 00:00:00 2001 From: mh <729263080@qq.com> Date: Mon, 1 Dec 2025 11:29:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E8=81=8A=E5=A4=A9=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=E5=BA=95=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Chat/Session/SessionController+Input.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Visual_Novel_iOS/Src/Modules/Chat/Session/SessionController+Input.swift b/Visual_Novel_iOS/Src/Modules/Chat/Session/SessionController+Input.swift index b02d7ae..4655ac0 100755 --- a/Visual_Novel_iOS/Src/Modules/Chat/Session/SessionController+Input.swift +++ b/Visual_Novel_iOS/Src/Modules/Chat/Session/SessionController+Input.swift @@ -50,6 +50,7 @@ extension SessionController { let scrToBottomBtn = UIButton(type: .custom) scrToBottomBtn.setImage(UIImage(named: "chat_scr_bottom"), for: .normal) + scrToBottomBtn.addTarget(self, action: #selector(scrToBottomBtnTap), for: .touchUpInside) let stackView = UIStackView(arrangedSubviews: [scrToBottomBtn, exchangeBtn]) stackView.spacing = 10.0 @@ -142,7 +143,14 @@ extension SessionController { } // MARK: - Helper - + @objc func scrToBottomBtnTap() { + let lastSection = tableView.numberOfSections - 1 + let lastRow = tableView.numberOfRows(inSection: lastSection) - 1 + if lastSection >= 0, lastRow >= 0 { + let ip = IndexPath(row: lastRow, section: lastSection) + tableView.scrollToRow(at: ip, at: .bottom, animated: true) + } + } func hideAllBottomViews(except:[UIView]? = nil){ let viewsExcept = except ?? []