UitableView中的部分的背景图像

1 iphone

如何在UiTableView中为部分标题的背景设置透明度的png图像?

The*_*uad 8

我想你需要在其中创建一个带有UIImageView的UIView.

像这样的东西:

- (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;
}
Run Code Online (Sandbox Code Playgroud)