简体   繁体   English

UitableView中部分的背景图像

[英]background image for section in UitableView

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

I think you will need to create a UIView with a UIImageView in it. 我认为您将需要创建一个带有UIImageView的UIView。

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;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM