【问题标题】:set BackgroundImage to UITableView Section (viewForHeaderInSection)将 BackgroundImage 设置为 UITableView Section (viewForHeaderInSection)
【发布时间】:2012-06-01 20:58:51
【问题描述】:

我试过了

    - (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

非常感谢

【问题讨论】:

    标签: xcode uitableview tableview sections


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-14
      • 2020-01-26
      • 1970-01-01
      • 2015-10-20
      相关资源
      最近更新 更多