1

私はiPadプロジェクトに取り組んでおり、縦向きと横向きの両方のモードを処理したいと考えています。

ランドスケープモードに入ると、UIBarButtonItem位置が変わりません。このボタンを動かしてバーの右側に配置する方法はありますか?

肖像画:

ここに画像の説明を入力してください

風景 :

ここに画像の説明を入力してください

ありがとうございました。

4

2 に答える 2

1

現在の場所の設定は以下をなめると思います:

ss

この設定では、左マージンの長さがランドスケープモードに採用されます。したがって、右マージンの長さを設定し、ボタンにナビゲーションバーの右端を配置させる必要があります。

以下のように設定することをお勧めします。

ss

これらの設定は、サイズインスペクターで編集できます(自分で確認してください)。

私はこのアドバイスであなたの助けになります。

于 2012-08-08T12:53:34.977 に答える
1

私はこのような問題を解決しました:

willAnimateRotationToInterfaceOrientation私が書いた方法で:

if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight){
        //Change the position of the profil button
        [self changeProfilButtonOrientation];   
    }else if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown || toInterfaceOrientation == UIInterfaceOrientationPortrait){

    }

そして私のchangeProfilButtonOrientation方法

-(void) changeProfilButtonOrientation{
    UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
    [self.toolBar setItems:[NSArray arrayWithObjects:flexibleSpace,profilButton, nil]];
}

そしてそれは動作します:-)

于 2012-08-08T13:13:49.413 に答える