I have a tableview. I reload a section. My sectionheader has a line that requires to be drawn. The positioning of this line and how it’s drawn is based on contentview’s frame
- If if do
tableview.reloadData()
it get’s drawn correctly. Tableview header’s frame is non-zero - If I do
notesTable.reloadSections([1], with: .automatic)
it doesn’t get drawn correctly. Tableview header’s frame is zero! ( I need to usereloadSections
because I want to animate it.reloadData()
doesn’t give any animation)
so a very watered down example of my viewForHeaderInSection
is:
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
// some code
sectionView.setupUI()
return sectionView
}
Header class:
class SectionHeaderclass: UITableViewHeaderFooterView{
func setupUI(){
let triangleViewArea = ViewWithTriangleLine(triangleCenter:Double(contentView.frame.width - 30))
}
}
contentView.frame.width
returns 0
if I animate the section reload. Why?! How can I fix this?