Width of my headerView does not adapt to the width of the screen.
My viewForHeaderInSection
function:
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let cell = self.tableView.dequeueReusableCellWithIdentifier("sectionCell") as! sectionCell
cell.hint.text = "some name"
cell.tag = section
let singleTap = UITapGestureRecognizer(target: self, action: #selector(singleTapOnSection(_:)))
cell.addGestureRecognizer(singleTap)
let view = UIView(frame: cell.frame)
view.addConstraints(cell.constraints)
view.addSubview(cell)
return view
}
I must add cell to the UIView (or something similar) because i have hiding of row in the section. In my opinion i must add to "view" some constraints programmatically, but i dont know how