table header 颜色的修改

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

{

// create the parent view that will hold header Label

UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 300.0, 44.0)];

// create the button object

UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];

headerLabel.backgroundColor = [UIColor colorWithRed:0.118192f green:0.120364f  blue:0.398641f alpha:0.7f];

headerLabel.opaque = NO;

headerLabel.textColor = [UIColor blackColor];

headerLabel.highlightedTextColor = [UIColor whiteColor];

headerLabel.font = [UIFont boldSystemFontOfSize:20];

headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 44.0);

    

// If you want to align the header text as centered

// headerLabel.frame = CGRectMake(150.0, 0.0, 300.0, 44.0);

    

    GroupInfo *rowdata = [[GroupInfo alloc] init] ;

    rowdata = [GroupArray objectAtIndex:section];

headerLabel.text = rowdata.GroupName; // i.e. array element

[customView addSubview:headerLabel];

    

return customView;

    [rowdata release];

    

}

你可能感兴趣的:(table header 颜色的修改)