I have three large UIImageViews displaying images in my iPad application (each one has almost the size of the screen, and they have special effects like rotation, shadows , etc. to look like a news stack) When these Images are displayed, the application works VERY SLOW . UIAlertViews literally look like they only have two frames when they are presented, and the animation is not even laggy ... they are worse! But when I do not imagine UIImageViews, everything works quickly and elegantly. Obviously, I'm doing something wrong, as iOS can handle three images. Any suggestions on how to make the application faster? Thanks.
PS I donβt even want to know what happens when I double the image resolution for the new iPad haha
Change Here is the code that I use to set the shadows. This uses the QuartzCore structure.
page2.layer.shadowColor = [UIColor blackColor].CGColor; page2.layer.shadowOpacity = 1.0; page2.layer.shadowRadius = 10.0; page2.layer.shadowOffset = CGSizeMake(0, 4);
Change 2 (Answer) . It seems that the lag is due to the way I adjust the shadows. If you set the shadowPath property to UIBezierPath the bounds of UIImageViews, rendering is faster and smoother, and the application speeds up significantly. Here is my final code:
page2.layer.shadowColor = [UIColor blackColor].CGColor; page2.layer.shadowOpacity = 1.0; page2.layer.shadowRadius = 10.0; page2.layer.shadowOffset = CGSizeMake(0, 4); page2.layer.masksToBounds = NO; UIBezierPath *path2 = [UIBezierPath bezierPathWithRect:page2.bounds]; page2.layer.shadowPath = path2.CGPath;
source share