「UIView#transitionFromView:toView:duration:options:completion:」のメソッドでは限られたアニメーションしかないが、push遷移のような左右にスライドするアニメーションを設けたいです。
CC BY-SA 3.0
2015-05-12T03:57:28.927
10069
2015-08-07T12:01:33.027
8060
question
ios objective-c
transitionFromViewでスライド遷移をしたい
Core Animationフレームワーク（Quartz Core Framework）の`CATransition`クラスを利用してください。

[CATransition Class
Reference](https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CATransition_class/index.html#//apple_ref/doc/uid/TP40004507)

[Core Animation Programming
Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004514)

[Transition Animations Support Changes to Layer
Visibility](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/AdvancedAnimationTricks/AdvancedAnimationTricks.html#//apple_ref/doc/uid/TP40004514-CH8-SW7)
CC BY-SA 3.0
2015-05-12T05:34:52.193
10072
2015-05-12T08:24:51.793
2015-05-12T08:24:51.793
7362
7362
10069
answer
pushっぽいアニメーションはこんなかんじですよ。

```

        [CATransaction begin];
        [CATransaction setValue:(id)kCFBooleanTrue
                         forKey:kCATransactionDisableActions];
    
        CATransition *transition = [CATransition animation];
        transition.delegate = self;
        transition.duration = .4f;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionPush;
        transition.subtype = (isRight)? kCATransitionFromLeft : kCATransitionFromRight;
        [targetView.layer addAnimation:transition
                                         forKey:nil];
    
        [CATransaction commit];
    
```
CC BY-SA 3.0
2015-08-07T12:01:33.027
13148
2015-08-07T12:01:33.027
3574
10069
answer