Я хочу использовать классику DeviceTableViewCell вместе с TDBadgedCell. Как мы используем два клана вместе? Например, ваш класс cellBadgedCell. Я хочу использовать badgeString с классом ячейки. Это будет так, как я показал в коде.
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var cellBadgedCell = tableView.dequeueReusableCell(withIdentifier:"BadgedCell") as? TDBadgedCell;
if(cellBadgedCell == nil) {
cellBadgedCell = TDBadgedCell(style: .default, reuseIdentifier: "BadgedCell");
}
cellBadgedCell?.badgeString = demoItems[indexPath.row]["badge"]!
cellBadgedCell.badgeColor = .orange
let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! DeviceTableViewCell
return cell
}
Функция, которую я хочу, должна быть такой:
cell?.badgeString = ıtems[indexPath.row]["badge"]!
cell.badgeColor = .orange