How to resize a tableHeaderView of a UITableView?

后端 未结 19 2232
死守一世寂寞
死守一世寂寞 2020-11-29 16:14

I\'m having trouble resizing a tableHeaderView. It simple doesn\'t work.

1) Create a UITableView and UIView (100 x 320 px);

2) Set the UIView as tableHeaderV

19条回答
  •  鱼传尺愫
    2020-11-29 17:00

    On iOS 9.x, doing this on viewDidLoad works just fine:

    var frame = headerView.frame
    frame.size.height = 11  // New size
    headerView.frame = frame
    

    headerView is declared as @IBOutlet var headerView: UIView! and connected on the storyboard, where it is placed at the top of the tableView, to function as the tableHeaderView.

提交回复
热议问题