WWDC2013_218 ——
Custom Transitions Using View Controllers ( 1 )
官方视频地址:https://developer.apple.com/wwdc/videos/
此文为自己总结的官方视频的内容概要,正在学习ing...
• New animation tools
1. The block based UIView animation API ( iOS 4 )
[UIView animationWithDuration:delay:options:animations:^{
// update properties
} completion: nil];
TIPS:
Views are layer backed in UIKit, and on iOS for that matter, and as you update those properties, the various properties are kind of updated at the layer level.
And when you're in that block, core animation objects get added to the layer, and that's actually what's driving the animations that you see throughout iOS.
+ (void)setAnimationsEnabled:(BOOL) //This API has a little bit of problems (*what?)
+ (void)performWithoutAnimation:(void ^(void))actions;
2. Spring animations
solutions to single dimensional harmonic oscillators.
+ (void)animateWithDuration:(NSTimeInterval)duration
delay:(NSTimeInterval)delay
usingSpringWithDamping:(CGFloat)dampingRatio// 0.0 < dampingRatio < = 1.0
initialSpringVelocity:(CGFloat)velocity
options:(UIViewAnimationOptions)options
animations:(void (^)(void))animations
completion:(void (^)(BOOL finished))completion;
3. Key-frame animations
is to CAKeyframeAnimation
+ (void)animateKeyframesWithDuration:(NSTimeInterval)duration
delay:(NSTimeInterval)delay
options:(UIViewKeyframeAnimationOptions)options
animations:(void (^)(void))animations
completion:(void (^)(BOOL finished))completion;
+ (void)addKeyframeWithRelativeStartTime:(double)frameStartTime
relativeDuration:(double)frameDuration
animations:(void (^)(void))animations
[UIView animateKeyframesWithDuration: .35
delay: 0.0
options: 0
animations: ^{
/*
Those add key frames are actually the key frame values of the particular property most likely,
or they could be multiple properties at different points in the animation.
*/
[UIView addKeyframe... animations: ^{...}];
[UIView addKeyframe... animations:^{...}];
[UIView addKeyframe... animations:^{
[someView setPosition:...];
// etc. }];
}
completion: ^(BOOL finished) {...}];
4. Snapshot API
- (UIView *)[UIView snapshotView]
- (UIView *)[UIView resizableSnapshotViewFromRect:(CGRect)rect
withCapInsets:(UIEdgeInsets)capInsets
TIPS:
When you create a snapshot, you can create snapshots of snapshots.
5. UIKit Dynamics
Distinct from UIView animation APIs