Core Animationなどをポリポリ研究

  1. CATransactionとBlock

    Discussion

    The completion block object that is guaranteed to be called (on the main thread) as soon as all animations subsequently added by this transaction group have completed (or have been removed.) If no animations are added before the current transaction group is committed (or the completion block is set to a different value,) the block will be invoked immediately.

    Available in iOS 4.0 and later.

    [CATransaction begin];

    [CATransaction setCompletionBlock:^{

        // block that runs when animations have completed

        [self.delegate performSelectorOnMainThread:@selector(_animationDidEnd:) 

                                        withObject:self 

                                     waitUntilDone:YES];

    }];

    [CATransaction setAnimationDuration:0.5];

    [CATransaction commit];

Theme = Manuscript Neue