Ok, my CTO gave me a code which I can use to present a viewcontroller from wherever I like to wherever I like. Meaning, from bottom to top, right to left, and etc... But then, the code which he gave uses a PRESENT VIEW CONTROLLER. I need a push to retain the Navigation Controller or Navigation Bar. And then one time, when we were at a certain bar to drink some beer and eat, I found out a blog. From: kiranjasvanee
FOR PUSHING THE VIEWCONTROLLER FROM LEFT TO RIGHT:
CATransition* transition = [CATransition animation]; transition.duration = .45; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionMoveIn; transition.subtype= kCATransitionFromLeft; [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; NameViewController *controller = [[NameViewController alloc] init]; [self.navigationController pushViewController:controller animated:NO];
FOR POPPING THE VIEWCONTROLLER FROM RIGHT TO LEFT:
CATransition* transition = [CATransition animation]; transition.duration = .45; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionMoveIn; transition.subtype= kCATransitionFromRight; [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; [self.navigationController popViewControllerAnimated:YES];
If you find this tutorial helpful, please share and subscribe!
Post a Comment