有没有办法从UITableView中删除分隔线? [英] Is there a way to remove the separator line from a UITableView?

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

问题描述

我正在寻找一种方法来在纯平模式下完全删除UITableView中的分隔线。这是以分组方式自动完成的,但这也以一种难以测量的方式更改表的维度。我已经设置分隔线颜色为colorClear。但这并不能完全解决问题。

I'm looking for a way to completely remove the separator line in a UITableView when in the plain mode. This is done automatically in grouped, but this also changes the dimensions of the table in a way that is hard to measure. I have set the seperator line color to colorClear. But this does not completely solve the problem.

由于我想在单元格中绘制一个自定义背景视图,而我想要的单元格是无缝的,一个像素保持在中间的线是导致我的问题。是否有更优雅的解决方法,然后使用分组视图,然后伸展它?

As I am trying to draw a custom background view in the cells, and I want the cells to be seamless, the one pixel line that remains in-between is causing me problems. Is there a more elegant workaround then using a grouped view and then stretching it?

提前感谢。

推荐答案

您可以使用 UITableView 属性 separatorStyle 来执行此操作。确保该属性设置为 UITableViewCellSeparatorStyleNone 并设置完毕。

You can do this with the UITableView property separatorStyle. Make sure the property is set to UITableViewCellSeparatorStyleNone and you're set.

Objective-C

Objective-C

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

在Swift中

tableView.separatorStyle = .None

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

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