1

I want to get rid of this white border or colorize it to black.

As you see on the image, i want to change the white borders those shown in red circles.

How can i change it?

enter image description here

after adding this cote to tableview controller's viewDidLoad method;

[self.tuzukCell.contentView.layer setBorderColor:[UIColor blackColor].CGColor];
[self.tuzukCell.contentView.layer setBorderWidth:2.0f];

the resulting border is:

enter image description here

Yunus Eren Güzel
  • 3,018
  • 11
  • 36
  • 63

4 Answers4

3

for static cell.. all of these methods .. must be setup in the storyboard file..

so.. click on storyboard file / Table view / Separator "none" / and choose desired color..

enter image description here

TonyMkenu
  • 7,597
  • 3
  • 27
  • 49
2

UITableViewCell contentView's underlying CALayer

Firstly import QuartzCore

#import <QuartzCore/QuartzCore.h>

Add this in cellForRowAtIndexPath in UITableView delegate method

[cell.contentView.layer setBorderColor:[UIColor blackColor].CGColor]; //any color u want to....
[cell.contentView.layer setBorderWidth:2.0f]; //set its width here

EDIT :Use this property according to requirement if tableview is static:

separatorStyle  property
separatorColor  property
backgroundView  property
Paresh Navadiya
  • 38,095
  • 11
  • 81
  • 132
0

In CellForRowAtIndexPath, try this (after you init your cell) :

cell.layer.borderColor = [UIColor blackColor].CGColor;

Of course you can change blackColor to any other UIColor.

You can also do :

cell.layer.borderWidth = 0;

If you just wan to hide it.

rdurand
  • 7,342
  • 3
  • 39
  • 72
0

the following code will change the separator color, which means that it will change the separator line between the cell and the border itself.

try this to change it to black:

tableView.separatorColor = [UIColor blackColor];

or to remove it:

tableView.separatorColor = [UIColor clearColor];
Kassem
  • 1,481
  • 3
  • 20
  • 42
  • use the code in the viewDidLoad if it did not work try [tableView setseparatorColor:[UIColor clearColor]]; – Kassem Nov 16 '12 at 11:31