Swift - Custom head region and custom UITableView tail regions being given constraint problem

 

1. UITableview go first preset height Agent

Default head height:

func tableview(_ tableView: UITableView, estimatedHeightForHeaderInSection section: Int) -> CGFloat{

  return 40

}

Preset tail height:

func tableview(_ tableView: UITableView, estimatedHeightForFooterInSection section: Int) -> CGFloat {

  return 33

}

 

Then go initialization method:

    override init(reuseIdentifier: String?) {

        super.init (reuseIdentifier: reuseIdentifier)

        configUI()

    }

 

So set UITableview custom head and tail must first achieve a preset height of the agency, estimates a height, or constraint error 

True district tail height and area head height directly UITableview themselves to get on the line

    /// partition head height view

    func tableView

(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat{

        return UITableView.automaticDimension

    }

 

    /// tail view partition height

    func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat{

        return UITableView.automaticDimension

    }

 

 

Guess you like

Origin www.cnblogs.com/qingzZ/p/11933979.html