Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8: Remove Underline from UITableViewRowAction

I've been banging my head against the wall with this one, so maybe someone here has done this before.

Anyway, I'm trying to change how the delete button looks in my UITableView, and I've got it mostly figured out. I'm changing it by setting the background Color to a UIImage of what I actually want it to look like.

Apparently, though, a UITableViewRowAction has a faint grey line under it, and I can't figure out how to make this disappear. Any pointers would be greatly appreciated. There's a link to what I'm talking about here:

enter image description here

Thank you very much!

like image 721
Kyle Bashour Avatar asked Oct 19 '22 19:10

Kyle Bashour


1 Answers

This is a separator line of UITableView. You can remove it by setting it's style as None.

Objective C:

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

Swift:

self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None

Initially separator line is not visible, because I think height of image or view added in cell is more than cell height.

And that's why while you swipe separator line is visible. If you are testing in Simulator than use Debug > Color Blended Layers of Simultor. Which is helpful to track overlapping views.

enter image description here

Edit:

iOS 8.0 introduced layoutMargins for UITableView. So it may be possible reason for that also.

Check out this answer for more information.

It explains to clear layout margins by setting cell layoutMargins as UIEdgeInsetsZero.

like image 101
Kampai Avatar answered Nov 01 '22 17:11

Kampai