How to remove borders or separators between cells in UITableView – iOS, iPhone, iPad

When you add a UITableView to your iOS application, there is always a light gray one pixel separator between each cell or row in UITableView.

You can remove this border by setting UITableView’s separatorStyle property to UITableViewCellSeparatorStyleNone and viola, there is no more separators between cells in UITableView.

tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

One thing to note here is that you can do this only for the whole UITableView and not for each individual cell for example inside cellForRowAtIndexPath delegate method.

separatorStyle of UITableView has 3 options:
UITableViewCellSeparatorStyleNone
UITableViewCellSeparatorStyleSingleLine — Default
UITableViewCellSeparatorStyleSingleLineEtched

Advertisements
  1. #1 by Micke De Geer on January 13, 2012 - 12:15 am

    You can actually do it for each cell using the following trick:

    cell.backgroundView = [[UIView alloc] initWithFrame:CGRectZero];

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: