ios - 如何在iOS 9.0或更高版本中将tableview单元格转换为带有阴影的圆角-LMLPHP

我想显示上图的表格单元格。
请帮帮我。

最佳答案

如果您使用普通表格视图单元格

cell.contentView.layer.cornerRadius = 7.0f;
cell.contentView.layer.masksToBounds = YES;


如果您使用自定义表格视图单元格

cell.layer.cornerRadius = 7.0f;
cell.layer.masksToBounds = YES;


在故事板上清除UITableView的背景颜色。然后,您将能够看到更改。

对于细胞行高度

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
  return 44;  //It default size.If you want to change to other size you can change.
}

10-07 19:49
查看更多