heightForHeaderInSection:とheightForFooterInSection:のデフォルト値

UITableViewControllerの中でヘッダーやフッターの高さを変えたいけど、デフォルトの高さも使いたい時。UITableViewAutomaticDimensionを返せばよい。

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
  if (section == 0) {
    return 32.0;
  } else {
    return UITableViewAutomaticDimension;
  }
}
Pocket
LINEで送る
LinkedIn にシェア