删除分组UITableView中的分隔符

时间:2011-12-02 15:05:17

标签: uitableview separator

我需要使用自定义单元格创建分组表格视图。每个单元格必须具有背景图像,以便一个单元格的图像将触摸第二个单元格的图像,依此类推。我试图将separatorStyle设置为None,但我仍然在单元格之间获得透明分隔符。 请帮助我,删除单元格之间的空格。

祝你有个美好的一天, 谢谢!

1 个答案:

答案 0 :(得分:0)

我发现当我设置背景图片时,分隔符会自动消失。问题是我希望它出现。

这就是我的所作所为:

创建自定义UITableViewCell类。在相应的init方法中执行:

    // Create a background image view.  
    self.backgroundView = [[UIImageView alloc] init];

然后在管理UITableView的控制器中:

- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // After all of the cell dequeue/allocation...

    UIImageView *backgroundView = (UIImageView *)cell.backgroundView;
    backgroundView.image = [UIImage imageNamed:@"your_image"];
}
相关问题