You can change the backgroundView of the TableViewCell, subclass the UIView, and change the layer class:
@interface BackgroundView : UIView @end @implementation BackgroundView + (Class)layerClass { return [CAShapeLayer class]; } @end
later in cellForRowAtIndexPath you will do something like this:
static NSString *CellIdentifier = @"CustomCell"; CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; CGRect frame = cell.backgroundView.frame; cell.backgroundView = [[BackgroundView alloc] initWithFrame:frame]; CGFloat corner = 20.0f; UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:cell.backgroundView.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(corner, corner)]; CAShapeLayer *shapeLayer = (CAShapeLayer *)cell.backgroundView.layer; shapeLayer.path = path.CGPath; shapeLayer.fillColor = cell.textLabel.backgroundColor.CGColor; shapeLayer.strokeColor = [UIColor lightGrayColor].CGColor; shapeLayer.lineWidth = 1.0f; return cell;
Result:

You can change the desired angles or create a different path.
Hope this helps.
source share