Avijit Nagare
Avijit Nagare

Reputation: 8782

iOS How to make more slow animation for api presentviewcontroller and dissmissviewcontroller?

I am using following code to slow animation.

      vc.modalPresentationStyle = UIModalPresentationCustom;
      vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

      [self presentViewController:vc animated:NO completion:nil];

for dismiss view used

 [self dismissViewControllerAnimated:NO completion:nil];

I need animation from Bottom to Top for presentviewcontroller and Top to bottom for dismissviewcontroller.

But this animation also to fast.How to make it slow?

Upvotes: 1

Views: 1613

Answers (1)

Rahul Mayani
Rahul Mayani

Reputation: 3831

Set duration time is more than 3...

CATransition *transition = [CATransition animation];
transition.duration = 3.4;
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromTop;
[[[[self  view] window] layer] addAnimation:transition forKey:nil];

[self presentViewController:vc animated:NO completion:NULL];

In Swift :-

let transition: CATransition = CATransition()
transition.duration = 3.4
transition.type = kCATransitionMoveIn
transition.subtype = kCATransitionFromTop
self.view.window?.layer.add(transition, forKey: nil)

self.present(vc, animated: false, completion: nil) 

Upvotes: 3

Related Questions