-systemLayoutSizeFittingSize: returning incorrect height for tableHeaderView under iOS 8

前端 未结 6 1785
旧时难觅i
旧时难觅i 2021-02-07 00:08

There are numerous threads about correctly sizing a tableHeaderView with auto-layout (one such thread) but they tend to pre-date iOS 8.

I have a situation with numerous

6条回答
  •  攒了一身酷
    2021-02-07 00:52

    I had a same problem. This works well for me on iOS 8.4.

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
        [self.myLabel sizeToFit];
        [self.tableView.tableHeaderView layoutIfNeeded];
        return UITableViewAutomaticDimension;
    }
    

提交回复
热议问题