Reputation: 3693
After hours of googling I am wondering if it is possible to change the corner radius of a grouped UITableView
.
I tried
hoursTable.layer.cornerRadius = 5.0;
but nothing seems to change.
Upvotes: 6
Views: 12050
Reputation: 1460
I would recommend to
1) make a subclass of UITableViewCell
and set the background color clear
2) make a subclass of UITableView
and set the separator color clear
3) use this cells in the tableview
now here is an important method t be implemented in UITableViewCell
subclass
in
- (void)drawRect:(CGRect)rect
method try to make a bezier path accordingly to fill and stroke path as far your corner radius and background color...
the content rect you can get by self.contentView.frame
in what you have to draw your new bezier path.
Upvotes: 2
Reputation: 8053
Are you sure use <QuartzCore/QuartzCore.h>
framework in your app
your method (hoursTable.layer.cornerRadius = 5.0;
) only give you rounded corners without having to add your tableview to a superView or clipping it.
also use
[hoursTable setClipsToBounds:YES];
this is work only ios 3....if you work ios 4 or ios 5x then see SO answer
Upvotes: 2
Reputation: 821
Make sure clip sub views of table view alon with ur code hoursTable.layer.cornerRadius = 5.0;
by code [hoursTable setClipsToBounds:YES];
hoursTable.layer.cornerRadius = 5.0;
[hoursTable setClipsToBounds:YES];
Upvotes: 5