High performance rounded corner UITableView

by Hans Pinckaers

The problem with the previous example was that I was using a second UIScrollView to scroll the UITableView and not the UITableView itself, which is a subclass of UIScrollView and highly optimized for scrolling.

Here is a solution. The advantage of this one is that it is fast, but it’s not that easy and straightforward.
There are three view related properties for the uitableviewcell:

@property(nonatomic, readonly, retain) UIView *contentView
 
@property(nonatomic, retain) UIView *backgroundView
 
@property(nonatomic, retain) UIView *selectedBackgroundView

The backgroundView of the first and last UITableCell will be changed so that they have rounded corners at the proper place.

The selectedBackgroundview will be changed so that the blue selection of the first and last table cell will be corrected with the rounded corners of the backgroundView.

The gradient is drawn with Core Graphics. So you also learn with this project how to draw a gradient.

The only negative point of this technique is that I needed to make the separatorColor “clearColor”.

Download the project

Here