WWDC2013_218 內容概要 ( 1 )

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


發佈了45 篇原創文章 · 獲贊 6 · 訪問量 20萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章