1

その画像ビューに1つの画像ビューがあり、そこに2つのtextFieldを配置しました。UITextfield の縦向きモードの位置にデバイスを配置すると正しいです。UITextfiled変更のデバイス位置を回転させたら。私を助けてください。私はIOS 6を使用しています。よろしくお願いします。

4

3 に答える 3

0

それを実装するには多くの方法があります: 1. 制約 (xcode->editor->pin から調整) 2. 実用的に。

個人的には、これについて深い知識を身につけることをお勧めします

レイ・ウェンダーリッヒ

于 2013-08-22T05:25:25.287 に答える
0

実装してみてください-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 。このメソッドは、デバイスが回転したときに呼び出されます。ここで のフレームを設定できますUITextField

または、AutoresizingMask を設定することもできます。

于 2013-08-22T05:25:38.560 に答える
0
  1. これは AUTO LAYOUT (iOS6 の新機能) によって実現できます。iOS6 で作成した新しい xib は、デフォルトで自動レイアウトが有効になります。制約を調整する必要があります。このために、テキスト フィールドと画像ビューを選択します。Xcode の [エディタ] メニューから、[ピン] を選択します。テキスト フィールドと画像ビューを固定します。

自動レイアウトの詳細については、この素晴らしいチュートリアルをお読みください。 http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2

  1. 実用的にこれを達成することもできます。

willAnimateRotationToInterfaceOrientation でテキスト フィールドと画像のフレームを設定します。

   - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
                                     duration:(NSTimeInterval)duration
   {
        [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];

        if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft
        ||  toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
        {
            // set frame for your text field and image in landscape orientation.
        }
        else
        {
            // set frame for your text field and image in landscape orientation.
        }
   }

それでおしまい。

于 2013-08-22T05:51:58.717 に答える