我正在从一个 View Controller 导航到另一个 View Controller 。有一个指定的默认时间用于从一个类导航到另一个类。我们能否以编程方式更改该时间,即我们能否提高或降低导航速度。
FlashScreen *Secreen=[[FlashScreen alloc]initWithNibName:nil bundle:nil];
[self.navigationController pushViewController:Secreen animated:YES];
最佳答案
You need to use a custom animation like seague Animation class file where you can give the Transition duration for moving from one view controller to another view controller
-(void)perform{
UIViewController *sourceViewController = (UIViewController *) [self sourceViewController];
UIViewController *destinationViewController = (UIViewController *) [self destinationViewController];
CATransition* transition = [CATransition animation];
if ([self.identifier isEqualToString:@"b"]){
transition.duration = .25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
transition.subtype = kCATransitionFromLeft; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
}else{
transition.duration = .25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionMoveIn;
transition.subtype = kCATransitionFromRight;
}
[sourceViewController.navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[sourceViewController.navigationController pushViewController:destinationViewController animated:NO];
}
关于iphone - 如何更改 iOS SDK 中的默认导航速度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18073021/