Andrew
Andrew

Reputation: 16051

CAGradientLayer slow?

I have a series of CAGradientLayers which are made when a view is loaded, but scrolling through them causes a bit of lag. Is there a way to reduce this lag?

Upvotes: 1

Views: 1417

Answers (2)

Gilad Novik
Gilad Novik

Reputation: 4614

Make sure to add:

l.shouldRasterize=YES;
l.rasterizationScale=[UIScreen mainScreen].scale;

Upvotes: 13

lxt
lxt

Reputation: 31304

Without knowing exactly what you're trying to do and how you're coding it this is going to be very difficult, if not impossible, to answer. Assuming everything is being done correctly, rasterizing the layers may help matters (layer.shouldRasterize = YES). But there may be improvements to me made in the code before having to resort to that.

Upvotes: 1

Related Questions