0

I'm using FSCalendar in tableview cell, calendar is working fine but their is an issue while reusing the cell by scrolling up the tableview to the calendar. The tableview became glitchy. Below is my code inside cell for row at indexPath:

let calendarCell = calendarTableView.dequeueReusableCell(withIdentifier: "calendarReuse")
let calendarView = calendarCell.viewWithTag(1) as! FSCalendar
calendarView.delegate = self
calendarView.dataSource = self
calendarView.register(DIYCalendarCell.self, forCellReuseIdentifier: "cell")
calendarView.reloadData()
return calendarCell

I'm trying to remove calendarView.reloadData() the table view is working fine, but the calendar not loading data anymore.

Find the link of the design here:

Design

Mayank Patel
  • 3,868
  • 10
  • 36
  • 59
Hisham Nd
  • 1
  • 3
  • How's your design and how many calendar view in your tableView ?? – Yash Bhikadiya Sep 19 '18 at 10:08
  • @YashBhikadiya here's a screenshot of the design: https://i.stack.imgur.com/AzKKE.png – Hisham Nd Sep 19 '18 at 10:33
  • you can add CalendarView in tableViewHeader instead of cellForRowAt indexPath.Hope this will work for you. – Yash Bhikadiya Sep 19 '18 at 10:48
  • I would also suggest not using `reloadData()`, as that reloads everything and you end up doing work you don't need to. Here's another way reload visible cells. https://stackoverflow.com/a/41032394/4475605. – Adrian Sep 19 '18 at 11:12

0 Answers0