我希望在JTAppleCalendar上的day单元格中显示一天的所有事件,为此,我在DateCell中创建了一个tableView,它是JTAppleCell的CustomCell。为此,我在DateCell里面创建了一个tableView,它是JTAppleCell的一个CustomCell,我无法添加tableView.datasource = self和tableView.delegate = self。我无法添加tableView.datasource = self和tableView.delegate = self。我应该在哪里做这个,或者我缺少什么?DateCell是工作的,除了tableView.cell.label.dateLabel,selectedView和dotView是工作的,任何帮助将是感激的,谢谢。
class DateCell: JTAppleCell {
@IBOutlet var dateLabel: UILabel!
@IBOutlet weak var selectedView: UIView!
@IBOutlet weak var dotView: UIView!
@IBOutlet weak var tableView: UITableView!
var calEvent = [CalEvent]()
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath)
cell.textLabel?.text = "test"
//cell.textLabel?.text = calEvent[indexPath.row].title
return cell
}
}
ViewController:在这里输入图片描述
extension ViewController: JTAppleCalendarViewDelegate {
func calendar(_ calendar: JTAppleCalendarView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTAppleCell {
print("Calendar cellfor Item at")
let cell = calendar.dequeueReusableJTAppleCell(withReuseIdentifier: "dateCell", for: indexPath) as! DateCell
self.calendar(calendar, willDisplay: cell, forItemAt: date, cellState: cellState, indexPath: indexPath)
return cell
}
}