0
我在我的tableView中有四个部分,我只希望最后一部分有一个清晰的分隔符。我知道如何为整个tableView做到这一点,但找不到我的问题的任何解决方案。我想到的唯一解决方案是在Photoshop中将图像单元创建为图像,并将该图像设置为单元格背景。有没有人有一个如何做到这一点,而不必使用Photoshop的想法?如何设置tableView的一个部分的分隔符清除
我在我的tableView中有四个部分,我只希望最后一部分有一个清晰的分隔符。我知道如何为整个tableView做到这一点,但找不到我的问题的任何解决方案。我想到的唯一解决方案是在Photoshop中将图像单元创建为图像,并将该图像设置为单元格背景。有没有人有一个如何做到这一点,而不必使用Photoshop的想法?如何设置tableView的一个部分的分隔符清除
试试这个
在查看didLoad
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
而且
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 1)];
view.backgroundColor = [UIColor greenColor];
view.tag = 101;
[cell addSubview:view];
}
if (indexPath.section == 0)
{
[[cell viewWithTag:101] setHidden:YES];
}
else if(indexPath.section == 1)
{
[[cell viewWithTag:101] setHidden:NO];
}
return cell;
}