Using the Bazier Path, you can give two upper or lower two or any numbers of angular radius (obviously, from 4).
Here I set the upper left and upper right corner for the cell background:
UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:cell.selectedBackgroundView.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadii:CGSizeMake(8.0f, 8.0f)]; CAShapeLayer *shape = [[CAShapeLayer alloc] init]; [shape setPath:rounded.CGPath]; cell.selectedBackgroundView.layer.mask = shape; rounded = nil; shape = nil;
And now you just want to set the angle for the first and last background of the cell.
And don't forget to add the QuartzCore Framework to your project and #import <QuartzCore/QuartzCore.h> to your class.
you can change the textlable text color when highlighting with:
cell.textLabel.highlightedTextColor = [UIColor blackColor];
Kdeogharkar
source share