Graphics Reference
In-Depth Information
}
@end
Custom Transitions
We've established that transitions are a powerful way to animate properties that would
otherwise be difficult to change smoothly. But the list of animation types for
CATransition
seems a bit limited.
What's even stranger is that Apple exposes Core Animation's transition feature via the
UIView
+transitionFromView:toView:duration:options:completion:
and
+transitionWithView:duration:options:animations:
methods, but the transition
options available are
completely different
to the constants made available via the
CATransition
type
property. The constants that can be specified for the
UIView
transition
method
options
parameter are as follows:
UIViewAnimationOptionTransitionFlipFromLeft
UIViewAnimationOptionTransitionFlipFromRight
UIViewAnimationOptionTransitionCurlUp
UIViewAnimationOptionTransitionCurlDown
UIViewAnimationOptionTransitionCrossDissolve
UIViewAnimationOptionTransitionFlipFromTop
UIViewAnimationOptionTransitionFlipFromBottom
With the exception of
UIViewAnimationOptionTransitionCrossDissolve
, none of these
transitions correspond to the
CATransition
types. You can test these alternative transitions
by using a modified version of our earlier transition example (see Listing 8.13).
Listing 8.13
Alternative Transition Implementation Using UIKit Methods
@interface
ViewController ()
@property
(
nonatomic
,
weak
)
IBOutlet
UIImageView
*imageView;
@property
(
nonatomic
,
copy
)
NSArray
*images;
@end
@implementation
ViewController
- (
void
)viewDidLoad
{
[
super
viewDidLoad
];
//set up images