kay.herzam
kay.herzam

Reputation: 3063

Bad performance in UIImageView when displaying shadows

I have got a scroll view displaying images. Its "clip subviews" setting is off, so images to the left and right are displayed as well. If I'm adding shadows to the image views like below (using QuartzCore), the scrolling performance is severly degraded.

imageView.layer.shadowOffset = CGSizeMake(0, 0);
imageView.layer.shadowColor = [[UIColor blackColor] CGColor];
imageView.layer.shadowRadius = 8.0;
imageView.layer.shadowOpacity = 0.9;

Is there a way to add shadows to image views in a better-perfoming way?

Upvotes: 0

Views: 139

Answers (1)

manileo86
manileo86

Reputation: 153

Try adding the following to your shadow settings.

imageView.layer.shadowPath = [UIBezierPath bezierPathWithRect:imageView.bounds].CGPath;

May be this will help in smoother scrolling.

Upvotes: 2

Related Questions