0
我使用了tableview功能,因此當選擇tableview單元格時,tableview將重新加載並在選定行中顯示覆選標記。所選行未突出顯示,並且不允許選擇多行。iOS 11 Tableview Selection
對於iOS 11,它按預期停止工作。我希望所選行顯示覆選標記。另外,所選行的背景不應突出顯示,也不允許選擇多行。
func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPath: IndexPath) -> UITableViewCell {
let clientCell = tableView.dequeueReusableCell(withIdentifier: "clientCell", for: indexPath)
clientCell.selectionStyle = .none
if selectedIdxPath == indexPath.row {
clientCell.accessoryType = UITableViewCellAccessoryType.checkmark
} else {
clientCell.accessoryType = UITableViewCellAccessoryType.none
}
return clientCell
}
func tableView(_ tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath) {
selectedIdxPath = indexPath.row
tableView.reloadData()
}