adit
adit

Reputation: 33674

drawing a circle UIButton performance

I am currently doing it the following:

  self.userProfileButton.layer.borderColor=[UIColor whiteColor].CGColor;
    self.userProfileButton.layer.borderWidth=1.5f;
    self.userProfileButton.layer.cornerRadius = 25;

size of the button is 50, so this makes it as a perfect circle. However, when I profile this using instrument, it seems that it's dropping the FPS down a bit. Any other idea on how to do this performance wise?

Upvotes: 3

Views: 1474

Answers (1)

ninjaneer
ninjaneer

Reputation: 7031

Rasterize it!

self.userProfileButton.layer.shouldRasterize = YES;
//For retina screens:
self.userProfileButton.layer.rasterizationScale = [[UIScreen mainScreen] scale];

Upvotes: 4

Related Questions