Reputation:
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.
Upvotes: 1
Views: 4247
Reputation: 2668
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;
}
Upvotes: 6
Reputation: 121
Try it
self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
Upvotes: 1