IOS 8: Remove underscore from UITableViewRowAction

I hit my head against the wall with this, so maybe someone here has done this before.

Anyway, I'm trying to change how the delete button looks in my UITableView, and I basically understood it. I change it by setting the background color in the UIImage of what I really want it to look like.

Apparently the UITableViewRowAction has a faint gray line beneath it, and I can't figure out how to do this. Any pointers would be greatly appreciated. There is a link to what I'm talking about here:

enter image description here

Many thanks!

+5
source share
2 answers

This is a UITableView separator string. You can remove it by setting it to None.

Goal C:

 self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 

Swift:

 self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None 

Initially, the separator line is not visible, because I think the height of the image or view added to the cell is greater than the height of the cell.

And that is why the dividing line is visible during scrolling. If you are testing in Simulator, use Debug> Color Mixed Layers for Simultor. This is useful for tracking overlapping views.

enter image description here

Edit:

IOS 8.0 introduces layoutMargins for UITableView . Therefore, this may be the reason.

See the answer for more details.

He explains to clear layouts by setting cell layoutMargins as UIEdgeInsetsZero .

+3
source

Try this on the cellForRowAtIndexPath Method

 for iOS lower versions if(indexPath.row != self.newCarArray.count-1){ UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(0, 44, 320, 2)]; line.backgroundColor = [UIColor redColor]; [cell addSubview:line]; } 

for upper versions of iOS 7

  if (indexPath.row == self.newCarArray.count-1) { cell.separatorInset = UIEdgeInsetsMake(0.f, 0.f, 0.f, cell.bounds.size.width); } 
0
source

Source: https://habr.com/ru/post/1210447/


All Articles