【发布时间】:2013-06-17 10:49:08
【问题描述】:
我有一个分组UITableView,我已经将其中一个单元格的背景设置为渐变图像,这样:
- (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;
}
单元格的背景已正确显示,但它不再有圆角,因为表格顶部和底部以及默认背景的其余单元格...我尝试设置 cornerRadius 属性表视图,但它没有工作。而且我无法为特定单元格设置cornerRadius。
我发现的唯一一篇处理同样问题的帖子实际上并没有得到答复 (grouped tableViewCell - no rounded corner after setting the background of a grouped table cell),有人可以帮我解决这个问题吗?
提前致谢
【问题讨论】:
标签: ios uitableview background rounded-corners