【发布时间】:2018-01-17 08:12:50
【问题描述】:
Table bounce on updating of cell label number of lines.
我正在更新我的单元格标签编号行并且表格反弹。 我的代码如下。
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: false)
let cell = tableView.cellForRow(at: indexPath) as! VendorTableViewCell
tableView.beginUpdates()
cell.cell_description.numberOfLines = (cell.cell_description.numberOfLines == 0) ? 2 : 0
self.cellStates?[indexPath.row - 1] = (cell.cell_description.numberOfLines == 0) ? .expanded: .collapsed
defer {
tableView.endUpdates()
}
}
【问题讨论】:
标签: ios iphone swift uitableview ios11