我如何加快iOS转换和赛门铁克?

是否可以在整个应用程序范围内设置一个属性,以将iOS应用程序中的转换速度提高一倍?

应用范围?

尝试在视图控制器的内容视图的背景层上设置速度属性。 速度= 2将是双倍速度。 您可以在viewDidLoad方法中为所有视图控制器进行设置。

你也许可以创build一个UIWindow的自定义子类,并且让这个窗口对象把它的view层的speed属性设置为像makeKeyWindow这样的瓶颈方法中的2.0。 您需要使所有应用程序的UIWindow对象使用您的自定义类。 我不得不做一些挖掘来弄清楚如何做到这一点。

苹果公司没有一个简单的方法来改变,因为它会使不同的应用程序之间的转换太多。 您可以将图层的速度加倍,但是这会影响其他animation的时间。 最好的方法是使用UIViewControler上的类别实现自己的转换。

的UIViewController + ShowModalFromView.h

 #import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface UIViewController (ShowModalFromView) - (void)presentModalViewController:(UIViewController *)modalViewController fromView:(UIView *)view; @end 

的UIViewController + ShowModalFromView.m

 #import "UIViewController+ShowModalFromView.h" @implementation UIViewController (ShowModalFromView) - (void)presentModalViewController:(UIViewController *)modalViewController fromView:(UIView *)view { modalViewController.modalPresentationStyle = UIModalPresentationFormSheet; // Add the modal viewController but don't animate it. We will handle the animation manually [self presentModalViewController:modalViewController animated:NO]; // Remove the shadow. It causes weird artifacts while animating the view. CGColorRef originalShadowColor = modalViewController.view.superview.layer.shadowColor; modalViewController.view.superview.layer.shadowColor = [[UIColor clearColor] CGColor]; // Save the original size of the viewController's view CGRect originalFrame = modalViewController.view.superview.frame; // Set the frame to the one of the view we want to animate from modalViewController.view.superview.frame = view.frame; // Begin animation [UIView animateWithDuration:1.0f animations:^{ // Set the original frame back modalViewController.view.superview.frame = originalFrame; } completion:^(BOOL finished) { // Set the original shadow color back after the animation has finished modalViewController.view.superview.layer.shadowColor = originalShadowColor; }]; } @end 

这可以很容易地改变使用任何你想要的animation过渡。 希望这可以帮助!