将背景图像设置为UITableView部分(viewForHeaderInSection)

时间:2012-06-01 20:58:52

标签: xcode uitableview tableview sections

我用

尝试过
    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 100)];
    headerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    headerView.opaque = NO;
    headerView.backgroundColor= [UIColor blackColor];


    return [headerView autorelease];
}

但是如何为这些部分设置 BackgroundImage

非常感谢

1 个答案:

答案 0 :(得分:0)

您可以将背景颜色设置为带图像的图案:

headerView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myBackground.png"]];
相关问题