1

enter image description here

The little white stripe at the bottom really throws off the design and I can't seem to figure out how to remove it.

This question had a high rated response that said to do this:

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

But that removed the grey from my background as well (set with setBackgroundColor:) so it didn't work either.

Community
  • 1
  • 1
user212541
  • 1,878
  • 1
  • 21
  • 30

2 Answers2

7

Add this to your viewDidLoad: to remove the table borders:

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

I didn't understood your problem quite well,but i recommend you to check the height of your cell background view,just as a test put an image as the cell background view and check if the white line stills there:

cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"imageName.png"]]autorelease];

//-----

The code you provide isn't working because you're creating a new blank UIView and setting it as the cell background!The correct method follows:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *CellIdentifier = @"ApplicationCell";

    UITableViewCell *cell = (UITableViewCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

        UIView *myBackgroundView = [[UIView alloc] init];
        myBackgroundView.frame = cell.frame;
        myBackgroundView.backgroundColor = [UIColor greenColor]; <== DESIRED COLOR

        cell.backgroundView = myBackgroundView;

    }

    return cell;

}
Mateus
  • 2,640
  • 5
  • 44
  • 62
  • Ok,i glad to help you 'user212541',check my edit to know why the code you provided wasn't working! – Mateus Apr 07 '13 at 23:29
1

Try it

self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
honami
  • 121
  • 1
  • 5