删除分组 UITableView 中的分隔符 [英] Remove separator in grouped UITableView

查看:31
本文介绍了删除分组 UITableView 中的分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to make a grouped table view with custom cells. Each cell must have a background image, so that image of one cell will touch the image of the second cell and so on. I've tried to set the separatorStyle to None, but I still get the transparent separator between cells. Help me, please, remove this space between cells.

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

Have a good day, Thanks!

推荐答案

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

I found that when I set the background image, the separator went away automatically. The problem is that I want it to show up.

这是我所做的:

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

Create a custom UITableViewCell class. In the respective init method do:

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

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

Then in your controller that manages the 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"];
}

这篇关于删除分组 UITableView 中的分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆