iOS 8 : Remove Underline from UITableViewRowAction

标签 ios objective-c xcode uitableview swift

我一直在用这个把头撞到墙上,所以也许这里有人以前做过这个。

无论如何,我正在尝试更改删除按钮在我的 UITableView 中的外观,并且我已经基本弄清楚了。我通过将背景颜色设置为我实际希望它看起来像的 UIImage 来更改它。

但显然,UITableViewRowAction 下方有一条微弱的灰色线,我不知道如何让它消失。任何指针将不胜感激。有指向我在这里谈论的内容的链接:

enter image description here

非常感谢!

最佳答案

这是UITableView的分隔线。您可以通过将其样式设置为 None 来删除它。

Objective-C :

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

swift :

self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None

最初分隔线是不可见的,因为我认为在单元格中添加的图像或 View 的高度大于单元格高度。

这就是为什么当您滑动时分隔线是可见的。如果您在 Simulator 中进行测试,请使用 Simultor 的 Debug > Color Blended Layers。这有助于跟踪重叠 View 。

enter image description here

编辑:

iOS 8.0 为 UITableView 引入了 layoutMargins。所以这也可能是原因。

看看这个 answer获取更多信息。

它解释了通过将 cell layoutMargins 设置为 UIEdgeInsetsZero 来清除布局边距。

关于iOS 8 : Remove Underline from UITableViewRowAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27793618/

相关文章:

ios - Xcode 导航栏、标签栏、 TableView 标题不显示

swift - 找到在 Xcode 中包含静态库的正确方法

ios - 如何从 iPhone 视频录制中实时捕捉逐帧图像

ios - 如何获得与 iPhone 上的联系人应用程序相同的部分索引标题

ios - 如何传递数据类型为 CMTime 的浮点值?

iphone 开发 : how to check if an object located on the phone's screen

javascript - 如何在 Xcode 中查看 PhoneGap 应用程序的 javascript 错误?

ios - ViewControllers 什么时候调用 deinit?在移动到后台期间?在暂停期间?

ios - 如何在xcode7中找到libicucore.dylib?

ios - CMSampleBufferRef 池写入 H.264 AVCC 流