Michael
Michael

Reputation: 105

UITableView: Hide border/separator between cells

Is it possible to hide the separator between the cells of an UITableView? But it should configure-able for each cell seperate (so not for the whole TableView).

What I already tried out is:

UIView *backView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
backView.backgroundColor = UIColorFromRGB(CELL_COLOR_DEFAULT);
cell.backgroundView = backView;

The only problem here is, that on the left and right side is also no border, but here I would need it.

Thanks NG

Upvotes: 2

Views: 2874

Answers (1)

samuelsaumanchan
samuelsaumanchan

Reputation: 617

So are you trying to have a border around the entire cell or just the separator?

You could try adding something like

cell.layer.borderColor = [[UIColor blackColor]CGColor];
cell.layer.borderWidth = 10.0f;

to your cellForRowAtIndexPath method (you can decide whether to display the border for a given cell than as well).

Upvotes: 1

Related Questions