【发布时间】:2019-08-28 07:45:26
【问题描述】:
我正在使用自定义 tableViewCell 来填充我的 tableView
1. title = UILabel()
2. subtitle = UITextView()
3. count = UILabel()
这些都是使用autoLayoutConstraints 以编程方式设置的。
然后,我将在我的主 viewController 中定义的 tableView 填充为 tableView datasource 和 tableView delegate。所以所有与tableView 相关的设置都发生在我的主视图控制器中。
我正在使用automaticDimension 来设置tableView 的rowHeight。
问题是,
当我使用 func tableView(moveRowAt:) 重新排列我的 tableView 行时,当我将选定的 tableView 行拖到另一个 indexPath 时,行高会缩小或折叠。
我该如何解决这个问题?
在课堂上MainViewController: UIViewController,
lazy var tableView: UITableView = {
let tv = UITableView()
tv.delegate = self
tv.dataSource = self
tv.separatorStyle = .none
tv.rowHeight = UITableView.automaticDimension
tv.backgroundColor = nil
tv.allowsMultipleSelectionDuringEditing = true
tv.allowsSelection = true
tv.estimatedRowHeight = 70
return tv
}()
【问题讨论】:
-
行减少到等于estimatedRowHeight的高度?
标签: ios swift uitableview