In iPhone, when we use push Segue in Storyboard, it always navigates from right
to left
. Can we implement any mechanism that it navigates left
to right
, or down
to top
?
I know about how to create Custom
Segue, but it does not work the same like Push
. Can you help me?
If you are developing an App for iOS 5, you can create a class that implement UIStoryboardSegue (to have custom segue), and then override the Perform
method in this way:
-(void)perform {
UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController];
CATransition* transition = [CATransition animation];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[sourceViewController.navigationController.view.layer addAnimation:transition forKey:kCATransition];
[sourceViewController.navigationController pushViewController:destinationController animated:NO];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.