I suggest to use the UITableViewCell subclass and add the custom view with the custom radius into the contentView.
Here is my simple implementation.
#import "TableViewCell.h"
#import "RoundedView.h"
@implementation TableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
RoundedView *roundedView = [[RoundedView alloc] initWithFrame:CGRectInset(self.contentView.bounds, 2, 2)];
[self.contentView addSubview:roundedView];
}
return self;
}
@end
And the rounded my simply set the rounded corner to the required edges.
#import "RoundedView.h"
@implementation RoundedView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
}
return self;
}
- (void)drawRect:(CGRect)rect{
CGContextRef context = UIGraphicsGetCurrentContext();
UIBezierPath *bp = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerBottomLeft cornerRadii:CGSizeMake(10, 10)];
CGContextAddPath(context, bp.CGPath);
CGContextClip(context);
[[UIColor brownColor] setFill];
UIRectFill(rect);
}
@end
And inside the cellForRowAtIndexPath:,
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL"];
if(!cell){
cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CELL"];
}
return cell;
}
Note since the view is added to cell only inside initWithStyle:reuseIdentifier: method, the view will only be draw when the a new cell is allocated. Most of the time, UITableView dequeues the cell and so this is only drawn few time.
And the final result looks like this,