2009-06-09 10 views
3

に変更することは可能ですか? 「グループ化された」テーブルでしか動作:あなたはUITableViewセクションタイトルの背景色を

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 
{ 
    return 30; 
} 


- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section  
{ 
    UIView *v = [[UIView alloc] init]; 
    [v setBackgroundColor:[UIColor blackColor]]; 
    return [v autorelease]; 
} 

これを使用する必要があります

答えて

4

は...

UPDATEなど、左利きのないので、任意のタイプミスを許しました。あなたのテーブルはグループ化されているのでしょうか?

0

はい。それはUIViewのを返したよう

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 

は、あなたが好きなものに設定することができますまたは単に

[UIView setBackgroundColor:UIColor];

:UITableViewDelegateプロトコルでメソッドを使用してHeaderInSectionをカスタマイズ