Michael Lau
Michael Lau

Reputation: 71

Xcode Segue View Controller Right to left without UINavigation

I want to transition my View Controller Right to Left (just like a Navigation Controller does IT) BUT without a UINavigationController embedded. I'm using Xcode 7 and the standard Segue seems to not have this option. Any guidance is VERY much welcome!!!

Upvotes: 0

Views: 1453

Answers (1)

beyowulf
beyowulf

Reputation: 15331

If you want to be a hack, you can do this:

CATransition *transition = [CATransition animation];
transition.duration = 0.3;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[self.view.window.layer addAnimation:transition forKey:nil];

[self presentModalViewController:viewCtrl animated:NO];

You should really just use a navigation controller or write a custom transition animation see here for a project that does the animation you want.

let transition = CATransition()
transition.duration = 0.3
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
transition.type = kCATransitionPush
transition.subtype = kCATransitionFromRight

self.view.window?.layer.addAnimation(transition,forKey:nil)
self.presentViewController(viewCtrl, animated: false, completion: nil)

if you need it in Swift.

Upvotes: 2

Related Questions