Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you review <a href="https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAAnimationGroup_class/Introduction/Introduction.html" rel="nofollow">the documentation</a>, you will note that <code>CAAnimationGroup</code> inherits from <code>CAAnimation</code>, and that <code>CAAnimation</code> can only be assigned to one <code>CALayer</code>. It's intent is really to make it easy to create and manage multiple animations you wish to apply to a <code>CALayer</code> at the same time, not to manager animations for multiple <code>CALayer</code> objects. </p> <p>To handle the sequencing of different animations between different <code>CALayer</code> or <code>UIView</code>objects, a technique I use is to create an <code>NSOperation</code> for each object/animation, then throw them into a <code>NSOperationQueue</code> to manage the sequencing. This is a bit complicated as you have to use the animation completion callback to tell the <code>NSOperation</code> it is finished, but if you write a good animation management subclass of <code>NSOperation</code>, it can be rather convenient and allow you to create sophisticated sequencing paths. The low-rent way of accomplishing the sequencing goal is to simply set the <code>beginTime</code> property on your <code>CAAnimation</code> object (which comes from it's adoption of the <code>CAMediaTiming</code> protocol) as appropriate to get the timing you want.</p> <p>With that said, I am going to point you to some code that I wrote and open-sourced to solve the exact same use case you describe. You may find it <a href="https://github.com/michaelkamprath/iPhoneMK/tree/master/Views/MKSoundCoordinatedAnimationView" rel="nofollow">on github here</a> (same code included). I will add the following notes:</p> <ul> <li>My animation management code allow your to define your animation in a plist by identifying the sequence and timing of image changes, scale changes, position changes, etc. It's actually pretty convenient and cleaner to adjust your animation in a plist file rather than in code (which is why I wrote this).</li> <li>If the user is not expected to interact with the subviews you creating, it's actually much better (less overhead) to create layer objects that are added as sub-layers to your hosting view's layer. </li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload