日々精進

新しく学んだことを書き留めていきます

iPhoneの回転を検出する

iPhoneの回転イベント発生時に何か処理をする方法を調べるとよくshouldAutorotateToInterfaceOrientationメソッドに処理を実装している例を見かけるがこれは間違いじゃないか?
shouldAutorotateToInterfaceOrientationは画面の回転を許可するかどうかを示すBOOL値を返すだけにすべき。
たぶん下記のメソッドを使うのが正しいはず。

– willRotateToInterfaceOrientation:duration:
– willAnimateRotationToInterfaceOrientation:duration:
– didRotateFromInterfaceOrientation:
– willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:
– didAnimateFirstHalfOfRotationToInterfaceOrientation:
– willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration: