-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFadeAnimator.m
33 lines (27 loc) · 958 Bytes
/
FadeAnimator.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// FadeAnimator.m
// CSV Touch
//
// Created by Simon Wigzell on 2017-12-27.
//
#import "FadeAnimator.h"
@implementation FadeAnimator
- (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext
{
return 0.25;
}
- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext
{
UIViewController *to = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIView *containerView = transitionContext.containerView;
[containerView addSubview:to.view];
to.view.alpha = 0.0;
[UIView animateWithDuration:[self transitionDuration:transitionContext]
animations:^{
to.view.alpha = 1.0;
}
completion:^(BOOL finished) {
[transitionContext completeTransition:!transitionContext.transitionWasCancelled];
}];
}
@end