Reputation: 2596
First screenshot is iOS7 that not what I want.
First screenshot is iOS6 that what I want.
Tableview's style is plain.
Tableview's separator is none.
And there is a backgroudView of that darkgray color.
I have code like below
if ([tableView respondsToSelector:@selector(setSeparatorInset:)])
{
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
cell.backgroundView = [[UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"icon_bg_box.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
Upvotes: 2
Views: 3703
Reputation: 9609
If you want to remove the separator line of tableviewcell
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Then add separator line for custom cell
UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];/// change size as you need.
separatorLineView.backgroundColor = [UIColor grayColor];// you can also put image here
[cell.contentView addSubview:separatorLineView];
Credits go to iPatel Answer
Upvotes: 0
Reputation: 11039
This will hide the separator
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Then add your custom separator imageView in every cell at bottom.
Upvotes: 4
Reputation: 2610
You need to add separate view as a seperator First make tableViews seperator to none
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
[cell addSubview:[self drawSeparationView:(indexPath.row)]];
return cell;
}
Then draw your seperator
- (UIView*)drawSeparationView:(NSInteger)itemNo {
UIView *view = [[UIView alloc] init];
view.frame = CGRectMake(0, 0, self.tableView.frame.size.width, cellHeight);
UIView *upperStrip = [[UIView alloc]init];
upperStrip.backgroundColor = [UIColor colorWithWhite:0.138 alpha:1.000];
upperStrip.frame = CGRectMake(0, 0, view.frame.size.width, 2);
[view addSubview:upperStrip];
UIView *lowerStrip = [[UIView alloc]init];
lowerStrip.backgroundColor = [UIColor colorWithWhite:0.063 alpha:1.000];
lowerStrip.frame = CGRectMake(0, cellHeight-2, view.frame.size.width, 2);
[view addSubview:lowerStrip];
return view;
}
The output will be something like this
Upvotes: 9
Reputation: 1483
Try this
self.tableview.separatorColor = [UIColor clearColor];
Upvotes: 1