Reputation: 219
that code blocks for storyboard viewcontrollers animation and its working but not what i want.. iwant left to right animation bu its doing "left bottom" corner to top right corner. not left to right why?
and second how can i stop animation?
UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController];
CATransition* transition = [CATransition animation];
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromRight;
[destinationController.view.layer addAnimation:transition forKey:kCATransition];
[sourceViewController presentViewController:destinationController animated:YES completion:nil];
Upvotes: 0
Views: 791
Reputation: 130172
CATransaction
.animated:NO
)Sidenote: changing the animation of modal controllers is "frowned upon". You will simplify the problem greatly if you just use a child view controller.
Upvotes: 1
Reputation: 15377
I believe the "left to right" animation you are looking for may be the push animation of a UINavigationController
. This may also be achievable with the kCATransitionPush
transition type. Also, presentViewController
triggers a "modal" animation (from bottom), so maybe using NO
for the animated
parameter in presentViewController
might help also if you are not using a UINavigationController
.
Upvotes: 0