Bonjour! Проблема в том, что мне не удается заполнить мое табличное представление данными. Хотя в некотором смысле это правильно, я понял, что программа снова и снова ставит один взгляд на другой. Ниже я приведу фрагменты кода, которые определенно связаны с проблемой
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if cell.isHidden == true {
cell.isHidden.toggle()
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let record = records[indexPath.section][indexPath.row]
let view = RecordView(price: record.price, place: record.place, time: record.date?.getDay(), category: record.category)
let cell = tableView.dequeueReusableCell(withIdentifier: "RecordViewCell", for: indexPath) as! RecordViewCell
cell.setRecordView(record: view)
cell.clipsToBounds = true
cell.contentView.backgroundColor = UIColor.clear
cell.layer.backgroundColor = UIColor.clear.cgColor
cell.backgroundColor = .clear
return cell
}
Кроме того,
class RecordViewCell: UITableViewCell {
@IBOutlet weak var view: UIView!
func setRecordView(record: RecordView) {
view.addSubview(record)
record.frame = CGRect(x: 5, y: 5, width: view.frame.width - 10, height: 60)
}
override func prepareForReuse() {
super.prepareForReuse()
self.isHidden = true
}
}
Это ссылка на пи c о том, как таблица выглядит в общем. Там вы можете видеть, что тени перекрываются и ошибаются.
Заранее большое спасибо.