Ios 为TableView分区添加背景
我有一个动态多行的部分,我需要将所有部分与背景分开,如下图所示 特别是所有路段的边界线。请让我知道如何才能做到这一点Ios 为TableView分区添加背景,ios,objective-c,uitableview,background-image,sections,Ios,Objective C,Uitableview,Background Image,Sections,我有一个动态多行的部分,我需要将所有部分与背景分开,如下图所示 特别是所有路段的边界线。请让我知道如何才能做到这一点 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; { return ProductArray.count; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)sect
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
{
return ProductArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSArray *arr = [ProductArray objectAtIndex:section];
return arr.count;
}
请参考这个
我尝试添加页眉和页脚,但我不明白如何为整个部分添加矩形框图像。在导出视图后将视图放入单元格。并使用此方法来cellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TableViewCell" forIndexPath:indexPath];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
cell.viewBackGround.backgroundColor = [UIColor redColor];
return cell;
}
对于上述要求,我建议您采用以下方法 仅创建一个包含多行的节
UITableView
的每一行都有UITableView单元格
UITableViewCell
create content视图中,我们将为其添加边框UITableViewCell
的每一行将有另一个UITableView
(在内容视图内),其方法由UITableViewCell
单元格处理UITableView
(内部)高度UITableViewCell
的高度请提供您迄今为止尝试的示例。您可以在单元格中使用圆角半径或颜色查看UIView。请查看