iOS 发送消息插入一行如何保证不闪屏
作者:
船长_ | 来源:发表于
2018-04-21 10:45 被阅读34次extension UITableView {
///保证 insert row 不闪屏
func insertRowsAtBottom(_ rows: [IndexPath]) {
UIView.setAnimationsEnabled(false)
CATransaction.begin()
CATransaction.setDisableActions(true)
self.beginUpdates()
self.insertRows(at: rows, with: .none)
self.endUpdates()
self.scrollToRow(at: rows[0], at: .bottom, animated: false)
CATransaction.commit()
UIView.setAnimationsEnabled(true)
}
}
本文标题:iOS 发送消息插入一行如何保证不闪屏
本文链接:https://www.haomeiwen.com/subject/geatlftx.html
网友评论