user409333
user409333

Reputation:

background image for section in UitableView

How can i set png image with transparency for background of section's header in UiTableView?

Upvotes: 1

Views: 4541

Answers (1)

TheSquad
TheSquad

Reputation: 7506

I think you will need to create a UIView with a UIImageView in it.

Something like that :

- (void) createHeader
{
    header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
    header.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
    UIImageView *headerImage = [[UIImageView alloc] initWithImage:yourImage];

    [header addSubview:headerImage];
    [headerImage release];
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return header;
}

Upvotes: 8

Related Questions