2012-02-11 2 views

答えて

6

、あなたが気にする4つの主要な方法があります:

shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation         duration:(NSTimeInterval)duration 

willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
          duration:(NSTimeInterval)duration 

didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 

を今、私は回転を処理する方法は例えば、ある:

  1. willAnimateRotationToInterfaceOrientationのすべてのフレームを調整します。

  2. サブビューを追加/削除する(必要な場合)willRotateToInterfaceOrientation;

  3. サブビュー(必要な場合)をdidRotateFromInterfaceOrientationに復元します。

さらに一般的には、willAnimateRotationToInterfaceOrientationでアニメーション化可能なすべてのプロパティを変更します。私はwillRotateToInterfaceOrientation/didRotateFromInterfaceOrientationでアニメーション化できないすべての変更を行います。

これはUIViewController referencewillRotate/didRotateについてこう言われる、

一時的に必要とされていない機能をオフにするか、それ以外の向きの変更中に問題が発生する可能性があります、あなたはwillRotateToInterfaceOrientationを上書きすることができます。期間:方法と必要なアクションを実行します。その後、didRotateFromInterfaceOrientation:メソッドをオーバーライドして、方向変更が完了したらそれらの機能を再度有効にすることができます。

関連する問題