How to resize a tableHeaderView of a UITableView?

后端 未结 19 2214
死守一世寂寞
死守一世寂寞 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 16:47

    This worked for me on iOS 7 and 8. This code is running on the table view controller.

    [UIView animateWithDuration:0.3 animations:^{
        CGRect oldFrame = self.headerView.frame;
        self.headerView.frame = CGRectMake(oldFrame.origin.x, oldFrame.origin.y, oldFrame.size.width, newHeight);
        [self.tableView setTableHeaderView:self.headerView];
    }];
    

提交回复
热议问题