0

I want to set an UIImageView on each of my custom UITableViewCell, however I want it to look like the images all join up. As it stands now I have moved the cell separator so that it doesn't cut over the top of the images, however I now need to work out a way to stop it taking up a couple of pixels inbetween each cell.

In the end I want to make the following black line join up seamlesly but still retain the seperator to the right. I have tried the following logic which uses an offset, however that didn't seem to work.

// This seems to shift the separator to the right which is good, however I want to get rid of the white line completely...
self.separatorInset = UIEdgeInsets(top: -1, left: 75, bottom: 0, right: 0)

Does anyone have any ideas on how I can achieve this?

enter image description here

  • i think that issue is your cell height and your setting cell height via code make sure your storyBoard tableivew cell height is same that setting heightForRowindex – Nitin Gohel Jun 22 '15 at 13:17

1 Answers1

1

First to explain how the separator works: The separator is a subview of the cell, your content is usually inside the cell's content view.

To overlap the separator, you have two options:

  1. Remove it completely using table.separatorStyle = UITableViewCellSeparatorStyleNone and add your own separator.

  2. If you want the image to overlap the separator, add it directly to the cell, not to the content view.

Sulthan
  • 128,090
  • 22
  • 218
  • 270
  • @NitinGohel Yes, exactly. If you need to remove the space between content view and the edge of the cell, removing the separator completely is your best option. You can always add a simple view to your cell to work as custom separator. – Sulthan Jun 22 '15 at 13:21
  • got it i forget to read last words 'add your own separator' :) – Nitin Gohel Jun 22 '15 at 13:22