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

查看:27
本文介绍了有没有办法从 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.

目标-C

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

在 Swift 中(3 之前)

In Swift (prior to 3)

tableView.separatorStyle = .None

在 Swift 3/4/5

In Swift 3/4/5

tableView.separatorStyle = .none

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

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