tableHeaderView/tableFooterViewの高さがUITableViewのスクロール領域に反映されないとき
UITableViewを使用しているとtableHeaderView/tableFooterViewに
UIViewが設定できるけど、代入の順番を間違えるとUITableViewのContentSizeに反映されない。
たとえばフッタに広告を設定するとき
// 広告設定
_bannerView= [[[GADBannerView alloc] init] autorelease];
_bannerView.backgroundColor = [UIColor blackColor];
_bannerView.frame = CGRectMake(0,
0,
GAD_SIZE_320x50.width, GAD_SIZE_320x50.height);
self.tableView.tableFooterView = _bannerView;
Viewのframeを設定してからtableFooterViewに代入すればちゃんとContentSizeにも反映される。
これはダメ
// 広告設定
_bannerView= [[[GADBannerView alloc] init] autorelease];
self.tableView.tableFooterView = _bannerView;
_bannerView.backgroundColor = [UIColor blackColor];
_bannerView.frame = CGRectMake(0,
0,
GAD_SIZE_320x50.width, GAD_SIZE_320x50.height);
tableFooterViewに代入してからframeを設定し直すと、上のレイヤーであるUITableViewのContentSizeまで変更が伝わらないみたい