I've a grouped UITableView
and I've set the background of one of its cells to be a gradient image, this way:
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
cell.textLabel.text = NSLocalizedString(@"Add item", @"");
cell.textLabel.backgroundColor = [UIColor clearColor];
UIImage* image1 =[[UIImage imageNamed:@"gradient_normal"] stretchableImageWithLeftCapWidth:5.0 topCapHeight:0.0];
UIImage* image2 =[[UIImage imageNamed:@"gradient_selected"] stretchableImageWithLeftCapWidth:5.0 topCapHeight:0.0];
cell.backgroundView = [[UIImageView alloc] initWithImage:image1];
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:image2];
}
return cell;
}
Background of the cell is correctly displayed, but it has not rounded corners anymore, as the rest of the cells at top and bottom of the table and with default background have... I tried setting the cornerRadius
property of the table view, but it didn't work. And I was not able to set the cornerRadius
for the particular cell.
The only post I found dealing with this same problem had not been actually answered (grouped tableViewCell - no rounded corner after setting the background of a grouped table cell), could somebody help me with this issue?
Thanks in advance