I am trying to set a custom footer in my table view. I created a footer in the nib file and created a managed file for it.
class LoginTableFooter: UITableViewHeaderFooterView
In viewDidLoad() I wrote this code
let footerNib = UINib(nibName: "LoginTableFooter", bundle: nil) tableView.register(footerNib, forHeaderFooterViewReuseIdentifier: "LoginTableFooter")
Then I implemented viewForFooterInSection
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { let cell = self.tableView.dequeueReusableHeaderFooterView(withIdentifier: "LoginTableFooter") let header = cell as! LoginTableFooter return cell }
viewForFooterInSection has never been called. I also tried to implement viewForHeaderInSection , but it was also not called. Do you have an idea what is wrong? I have only one section in my table view; Is it possible / better to set the footer directly to viewDidLoad ?
source share