9

I want to remove the built in separation between cells in UITableView.

I tried using :

[self.myTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

But that only removes the separator line. I need the view to appear as if it's not a table view at all. (like the tableview is one big view who doesn't contain many separated cells)

Is that possible ?

Edit: See the separation between the cells? I wan't it to disappear and the table view to be as if it's one big cell.

enter image description here

Edit 2: The problem doesn't appear when I don't use an image view as the cell background, but just use a simple background color. I tried using a different image, and as you can see the problem is much less obvious. I would still appreciate a solution for the red image though, since I do have a lot of images that still can't be put as background currently. (Not sure why one image would cause the problem and other won't ,I guess something with the pic setting)

enter image description here

Idan
  • 5,717
  • 10
  • 47
  • 84
  • If it shouldn't look like an UITableView then why are you using one? – Antwan van Houdt Jan 31 '11 at 18:32
  • 2
    @AntwanVanHoudt - table views are ther for laying out data. What. The end result looks like is irrelevant. – Moshe Jan 31 '11 at 18:51
  • If you use `UITableViewStylePlain` and no section titles/footers, you should not see any separators at all. – Costique Jan 31 '11 at 19:16
  • 1
    It looks like the red image has shading, and the top of each cell shows the top of the image, which creates the line effects. If you want the gradient in that image without the appearance of separation, lay the table view on top of the image, and set the table view cell colors as UIColor clearColor. This should stop it from repeating in every cell. – Alex Gosselin Jun 04 '11 at 19:56

7 Answers7

19

You can do something like

self.tableView.separatorColor = [UIColor whiteColor];

or

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

I suppose in your case it would be

self.myTableView.separatorColor = [UIColor whiteColor];

In the future you might want to search Stack Overflow as there are many similar questions.

Community
  • 1
  • 1
aqua
  • 3,269
  • 28
  • 41
  • Haven't you read my question ? cause I tried already exactly what you suggested and it didn't do all the job. – Idan Feb 01 '11 at 07:01
  • Well it's confusing _what_ you want because you say "I need the view to appear as if it's not a table view at all. (like the tableview is one big view who doesn't contain many separated cells)" which leads me (and other posters) to wonder _why_ you're using a TableView at all. If you want the table view structure without the scrolling effect just do `self.tableView.scrollEnabled = NO;` Maybe you can clarify your question if you aren't getting satisfactory replies. – aqua Feb 01 '11 at 07:47
7

Your separation is due to the background gradient in the red example and it is not coming from the tableView. in your second image there is no gradient so you don't see separation.

remove the gradient from the background image and it will be fine.

shannoga
  • 19,649
  • 20
  • 104
  • 169
6

try to do this:

self.tableView.backgroundColor=[UIColor clearColor];
self.tableview.separatorColor=[UIColor clearColor];
self.view.backgroundColor=[UIColor yourcolor];

i don't remember if it's then color with image or backgroundwithimage or background with view.. don't remember, however logic way is this.

hope it's usefull

italianGuy
  • 61
  • 1
  • 1
2

If you just want to get rid of the separator between UITableView cells. Two things you need.

  1. [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
  2. Make sure your imageView ( in your tableview cell) has same height as tableview cell. This means your image view is fully covering the table view cell. Goto inspector view and verify the height , if you see the height is 43 just set it to 44 ( 44 is default tableview cell height for retina display).

enter image description here enter image description here enter image description here

dotnetcoder
  • 3,431
  • 9
  • 54
  • 80
2

Go StroyBaord -> Select Table -> Attribute inspector -> Separator None No Separator Will Appear enter image description here

AyAz
  • 2,027
  • 2
  • 21
  • 28
1

You seem to have answered your own question. If you want a solid colored background, make an image with just a solid color. I suspect it's not best practice, but it will get the job done.

Moshe
  • 57,511
  • 78
  • 272
  • 425
  • Hi Moshe, I do use custom cells, but I guess the problem is not with the cells, it's with how the TableView present them. – Idan Feb 01 '11 at 06:59
  • I will try your suggestion about the sections and let you know the results. thanks – Idan Feb 01 '11 at 07:00
  • Sorry man, but your suggestion didn't work. Maybe you didn't understood me well, see my question now - I edited it. – Idan Feb 01 '11 at 09:40
0

I've done this many times in my own applications. I understand that you wish to make your tableview look as if its not a tableview but as if its on a blank piece of paper.

Just a note for you, the reason you can see the separation with some images and not so much with others is due to its image texture. When you place copies of the image side by side, they dont have a continuous pattern thus forming obvious visual separations.

Solution: Assuming you have the tableview setup in a xib file, display the background of the table itself to to clear -> then set the background of the view itself to whatever image you like. You will then have a tableview with the background view being transparent with only the main view behind it showing its image or color. Displaying your image on this canvas will mean a clear one image background.

Pavan
  • 17,840
  • 8
  • 59
  • 100