UITableViewContollerで、viewForHeaderInSection はiOS6から。iOS5ではあってもエラーにならないが、グループ毎のヘッダーを表示したい場合(?)は、titleForHeaderInSection がいるようです。heightForHeaderInSection は iOS5でもiOS6でもどっちでも要る?
iOSのバージョンの取得の一例
float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
バージョンによる分岐は、cellForRowAtIndexPathでのセルの取得の仕方?が異なるようですのでそこでも使います。
static NSString *CellIdentifier = @"Cell";
UITableViewCell*cell;
if(systemVersion >= 6.0){
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
} else {
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(!cell){
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
}
本当にこんなふうにするのかな?
0 件のコメント:
コメントを投稿