角色聊天滚动到底部
This commit is contained in:
parent
13161f4af3
commit
600f47c18d
|
|
@ -50,6 +50,7 @@ extension SessionController {
|
||||||
|
|
||||||
let scrToBottomBtn = UIButton(type: .custom)
|
let scrToBottomBtn = UIButton(type: .custom)
|
||||||
scrToBottomBtn.setImage(UIImage(named: "chat_scr_bottom"), for: .normal)
|
scrToBottomBtn.setImage(UIImage(named: "chat_scr_bottom"), for: .normal)
|
||||||
|
scrToBottomBtn.addTarget(self, action: #selector(scrToBottomBtnTap), for: .touchUpInside)
|
||||||
|
|
||||||
let stackView = UIStackView(arrangedSubviews: [scrToBottomBtn, exchangeBtn])
|
let stackView = UIStackView(arrangedSubviews: [scrToBottomBtn, exchangeBtn])
|
||||||
stackView.spacing = 10.0
|
stackView.spacing = 10.0
|
||||||
|
|
@ -142,7 +143,14 @@ extension SessionController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Helper
|
// 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){
|
func hideAllBottomViews(except:[UIView]? = nil){
|
||||||
let viewsExcept = except ?? []
|
let viewsExcept = except ?? []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue