你好,我正在尝试为分组表格视图部分(而不是区域标题)设置背景图像,我正在使用以下代码:
-(void)addBackgroundViewForSectionIndex:(int)tagIndex {
for (UIView * subview in tbl_home.subviews) {
if(subview.tag == tagIndex)
[subview removeFromSuperview];
}
CGRect sectionFrame = [tbl_home rectForSection:tagIndex];
UIImageView *newView = [[UIImageView alloc]initWithFrame:sectionFrame];
newView.tag = tagIndex;
[newView setImage:[UIImage imageNamed:@"Section@2x.png"]];
[tbl_home addSubview:newView];
[tbl_home sendSubviewToBack:newView];
}
将图片设置为背景,但有些单元格无法显示或者newView
覆盖了一些单元格。
我想要像下面的截图一样设置图片: