uitableview - 删除分组 UITableView 中的分隔符

标签 uitableview separator

我需要制作一个包含自定义单元格的分组 TableView 。每个单元格都必须有一个背景图像,这样一个单元格的图像就会触及第二个单元格的图像,依此类推。我尝试将 separatorStyle 设置为 None,但我仍然在单元格之间获得透明分隔符。 请帮助我,删除单元格之间的空格。

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

最佳答案

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

这是我做的:

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

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

然后在管理 UITableView 的 Controller 中:

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

关于uitableview - 删除分组 UITableView 中的分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8358287/

相关文章:

ios - dequeueReusableCellWithIdentifier 不释放数据

iphone - 如何检测是否在 xcode 7 中点击了表格 View 单元格

ipad - 如何将单元格从 TableView1 移动/重新排序到 TableView2

iphone - UI TableView 单元格在 swift 中使用 coredata 打开包含多个数据的新 View

java - 从打印语句中删除最后一个分隔符

javascript - 匹配不同格式的数字

iphone - UIPickerView 和 UITableView subview : problem with scroll after new data given

html - 在表格菜单中的菜单项之间添加分隔符

java - 分离 JLayeredPane

c# - 如何在 C# 中使用 BCL 拆分字符串而不丢失分隔符?