Find an explanation of differences in animation performance between iOS6 and iOS7

I am working on an iPad application that animates on very large images (full-screen images that can be magnified by 2x and still be retina quality). I spent a lot of time getting smooth transitions when zooming and panning. However, when starting the application on iOS7 animations become very jerky (slow frame rate).

Further testing shows that the zoom animation causes a problem (panning does not cause a problem). Interestingly, I was able to fix this by setting alpha for the scalable image to 0.995 (instead of 1.0 ).

I have two questions

  • What has changed in iOS7 to make this happen?
  • Why does changing transparency of a view matter?

Additional information on the above issues:

Animation Setup

Animations are all predefined and played back when interacting with the user. Animation is a combination of panning and zooming. The animation is very simple:

 [UIView animateWithDuration:animationDuration delay:animationDelay options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.frame = nextFrame; //... } completion:^(BOOL finished) { //... }]; 

To fix jerky animation, I set alpha before animation

 self.alpha = 0.99; 

Some interesting points:

  • Setting alpha inside animation also works
  • Setting alpha back to 1.0 after the animation, and then performing inverse animation with 1.0 alpha does not give smooth inverse animation.

Opacity

I previously used opacity correction to make the animation smooth while zooming and panning multiple images. For example, I had two large images, panning and zooming at different speeds with one on top of the other. When the previously uncorrected part of the lower image (the image below) began to be displayed, the animation will become a jerk (panning as well as zooming). My thought about why alpha helps in this case is that if the top image has a bit of transparency, the bottom image should always be displayed, which means that it can be cached before the animation happens. This idea is supported by doing reverse animation and not seeing jerky animation. (Probably, I would be interested to know if anyone has different thoughts on this).

Having said the above, I do not know how this will affect when there will be only one image (as in the situation that I describe in my question). In particular, when after receiving jerky animation, the reverse animation is still twitching. Another point of difference between the two situations is that only zooming causes the problem in the current problem, while in the double-image problem it is panning as well as zooming.


Hope the foregoing is clear - any ideas appreciated.

+7
objective-c ios6 ios7 ipad core-animation
source share
1 answer

Look at the opacity of the group. iOS 7 is enabled by default, and this changes the way layouts / layers are arranged:

If the UIViewGroupOpacity key is missing, the default value is now yes. The default value was previously NO.

This means that the subroutines of the transparent view will first be arranged into this transparent view, then the pre-positioned subtree will be drawn as a whole against the background. Setting NO leads to less expensive, but also less accurate, compositing: each view in a transparent subtree is composed on the fact that under it, according to the opacity of the parents, in the order of the algorithm of normal painters.

(source: iOS7 Release Notes )

Using this option, composition — also during animation — is much more expensive.

Also, look at the CoreGraphics Instruments tool to see if you have many off-screen images that are being collected.

Do you have any changes in the animation representation? This will cause more discarding of the image of the displayed layer from the backup storage.

+4
source share

All Articles