2011-08-12 9 views
1

私はiPhoneアプリケーションを開発しています。オリエンテーションが進行中かどうかを示すUIViewControllerにデフォルトの状態/アクセッサがありますか?現在、私は次のことを行っているUIViewController:識別オリエンテーションが進行中です

BOOLメンバーUIViewControllerのサブクラスではisOrientationChangeInProgress

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 
isOrientationChangeInProgress = YES; 
} 

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
{ 
isOrientationChangeInProgress = NO; 
} 

は、任意のより良い方法はあります言いますか?

+1

を発生したとき? – jtbandes

答えて

0

アップルはwillRotateToInterfaceOrientation:duration:でアニメーションを開始するようにアドバイスしているので、そのメソッドが呼び出された直後に回転が発生します。 durationプロパティは、回転が終了するとdidRotateFromInterfaceOrientation:が呼び出されるまでの時間、または約2秒後に呼び出される時間を示します。

だから、あなたのBOOLは後天的には最高のものだと思います。私はあなたがなぜこれを知る必要があるのか​​理解していません。多分、あなたの望む結果は別の方法で達成することができます。あなたは何をしようとしているのですか?

0

あなたにも、デバイスの向きの情報を伝えることに依頼することができます

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) 
               name:UIDeviceOrientationDidChangeNotification object:nil]; 

あなたはその後、orientationChangedに告げます:あなたはこれを必要とするのはなぜ変更が

関連する問題