2014年4月27日日曜日

UITableViewのヘッダの背景色を変更する。

UITableViewを利用するとき、Viewを作るのは面倒だけど、背景色を変えたいという時が有ると思います。

そんな時はこのコード。


#pragma mark -
#pragma mark UITableViewDelegate method
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
    if(section == 0)
    {
        [view setTintColor:[UIColor orangeColor]];
    }
    else if(section == 1)
    {
        [view setTintColor:[UIColor greenColor]];
    }
}

サンプルとはいえ、色合いが。。。

0 件のコメント:

コメントを投稿