2012-04-04 4 views

答えて

7

アプリケーション全体ですか?

ビューコントローラのコンテンツビューのバッキングレイヤーでspeedプロパティを設定してみてください。 speed = 2は倍速になります。おそらく、すべてのビューコントローラのviewDidLoadメソッドでこれを設定することができます。

また、UIWindowのカスタムサブクラスを作成し、そのウィンドウオブジェクトに、makeKeyWindowのようなボトルネックの方法で、表示レイヤーのspeedプロパティを2.0に設定させることもできます。すべてのアプリケーションのUIWindowオブジェクトにカスタムクラスを使用させる必要があります。私はそれをする方法を理解するためにいくつかの掘削をしなければならないだろう。

+4

「UIWindow」をサブクラス化する必要はありません。ウィンドウを作成した直後に、アプリケーションデリゲートで 'self.window.layer.speed = 2.0f'を実行することができます。 – Costique

3

Appleは、異なるアプリケーション間で遷移があまりにも異質になるため、簡単に変更することはできません。レイヤーの速度を2倍にすることはできますが、それは残りのアニメーションのタイミングを乱すことになります。 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 

これは、簡単にあなたが欲しいものは何でもアニメーショントランジション使用するように変更することができます。お役に立てれば!

関連する問題