So I have a scrollView with like 10 buttons on one side. Always when I scroll to that page, I get lots of bad performance. Then I noticed it was the CALayer that was creating the lag! I’ve used
button.layer.cornerRadius = 25;
button.layer.clipsToBounds = YES;
When I searched on the internet, I found out that I could use
button.layer.shouldRasterize = YES;
it should work better. But it just lowered the resolution and did not improve the performance. So I tried cutting the edges off in GIMP, but when I added them to XCode, they got filled in with white! So, please, tell me, is there any way that I can round corners without bad performance, by CALayer or without, doesn’t matter. Any help appreciated!
(ps. if you need the whole code or image, tell me and I’ll add it)
UPDATE:
It only works with bad performance on the iPhone 4, I tried it on my iPad Mini, and it worked just fine!
You can create those images with GIMP like you suggested. The key to success is to set the
opaquevalue of the view toNO, which means to enable transparency. But remember that setting a view’s opaque value to NO can result in loss of performance especially in fast changing views likeUIScrollViewCell.In your case it’s fast enough, in other cases maybe not. If the background is a single color, it is better to use that color as background color in your image manipulation program. (and set
opaque = YES;)