0

I have UITableView on top of UIView. There is a custom View that is added to UItableView at runtime.

All above views are created using xib.

I want the tableheaderView to be resized when device orientation changes. I tired changing the HeaderView Rect in the callbacks that we get while orientation. But changing the rect only changes the headerView but doesnt push the UITableView cells above and there is gap that can be seen.

Note:- using the size classes in xib doesn't help as the view is attached at runtime to UITableView.

Please let me know what is the better approach that can be used to achieve this.

Ekra
  • 3,241
  • 10
  • 41
  • 61

1 Answers1

3

I think you need to call tableView setTableHeaderView: again with your view after resizing the frame. This should force it to update.

How to resize a tableHeaderView of a UITableView?

Community
  • 1
  • 1
mofojed
  • 1,342
  • 9
  • 11
  • This is pretty much what you have to do. There are other ways around this, but this resets the scrollview size and everything in conjunction with the tableView. – TheCodingArt Jul 26 '15 at 21:36