John Topley
John Topley

Reputation: 115422

Removing internal separator from two grouped UITableView cells

I have a grouped UITableView that contains two cells. I've set a custom separatorColor for the table view, but would like to get rid of the internal separator in between the two cells, so that it looks like one cell. I want to keep the external separator around the edge of the cells.

What I have now:

A grouped table view with two cells and a visible separator

What I'd like to achieve:

A grouped table view with two cells and no visible separator

Is this possible? My project is targetting iOS 5.0 and above. Thanks in advance.

Upvotes: 2

Views: 1576

Answers (3)

happs
happs

Reputation: 139

Does this have to be a dynamic table? you mentioned that it only has two cells.. perhaps you could look at making the table/section one cell with a larger row height? or perhaps not put it in a table at all? instead use a UIView:

#import <QuartzCore/QuartzCore.h>

-(void)viewDidLoad
{
    [myview.layer setBorderWidth:1];
    [myview.layer setBorderColor:[[UIColor lightGrayColor] CGColor]];
    [myView.layer setCornerRadius:20];
}

the above code will give you the rounded corners on any view you desire just swap out themyview variable.

Upvotes: 1

Abhishek Singh
Abhishek Singh

Reputation: 6166

Try Adding

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

or U can add

UIView *backgroundVie = [[UIView alloc] init];
backgroundVie.backgroundColor = [UIColor clearColor];
    cell.backgroundView=backgroundVie ;

Upvotes: -1

andykkt
andykkt

Reputation: 1706

Try changing separator style of the table view too.

tableView.separatorColor = [UIColor clearColor]; 
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

Upvotes: 3

Related Questions