UITableView
默认情况下,重用单元格。但在我的例子中,有些细胞有
UITextField
我当前使用的代码示例:
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UINib(nibName: "TPAddressInfoTableViewCell", bundle: nil), forCellReuseIdentifier: InfoCellIdentifier)
...
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let item = items[indexPath.row]
switch item.appearance {
case .textWithTitle:
let cell = tableView.dequeueReusableCell(withIdentifier: InfoCellIdentifier) as! TPAddressInfoTableViewCell
return cell
case .picker:
...
UITextFieldDelegate
每个电池的电流
UIViewController