Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView cornerRadius with border performance issues on iOS

I have some interesting notice with scrolling performance on UITableView with cornerRadius, borderWidth and borderColor enabled.

self.tableView.layer.cornerRadius = 10.f;
self.tableView.layer.borderWidth = 1.0f;
self.tableView.layer.borderColor = [UIColor whiteColor].CGColor;

If I remove borderWidth and borderColor than scrolling gets 60 FPS no problem. As long as I add those two properties to layer FPS drops.

Does anyone have a suggestion or explanation why this strange behavior happens?

Many Thanks!

like image 409
Borut Tomazin Avatar asked Jun 27 '12 11:06

Borut Tomazin


1 Answers

CALayer having shouldRasterize property for this type of performance issue. Just set

self.tableView.layer.shouldRasterize = YES;

This single line saved my lot of time and work.

like image 80
Mohd Iftekhar Qurashi Avatar answered Sep 21 '22 12:09

Mohd Iftekhar Qurashi