set BackgroundImage to UITableView Section (viewForHeaderInSection)

≯℡__Kan透↙ 提交于 2019-12-12 05:06:50

问题


I have tried it with

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

But how can i set a BackgroundImage to the sections?

Thanks much


回答1:


You can set the background colour to a pattern with image:

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


来源:https://stackoverflow.com/questions/10857241/set-backgroundimage-to-uitableview-section-viewforheaderinsection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!