TableView header section disappear swift

Problem:

I had tried the following code for tableview header for cell reused but sometimes the header disappears.

func tableView(_ tableView: UITableViewviewForHeaderInSection section: Int) -> UIView? {

    let myCell = table.dequeueReusableCell(withIdentifier"myCell"as! myCell

      return myCell

}


 Solution:

You can use the below code to solve the issue.

func tableView(_ tableView: UITableViewviewForHeaderInSection section: Int) -> UIView? {

    let myCell = table.dequeueReusableCell(withIdentifier"myCell"as! myCell

      return myCell.contentView // This line changes for solving

}


Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift