私はiPadプロジェクトに取り組んでおり、縦向きと横向きの両方のモードを処理したいと考えています。
ランドスケープモードに入ると、UIBarButtonItem
位置が変わりません。このボタンを動かしてバーの右側に配置する方法はありますか?
肖像画:
風景 :
ありがとうございました。
私はiPadプロジェクトに取り組んでおり、縦向きと横向きの両方のモードを処理したいと考えています。
ランドスケープモードに入ると、UIBarButtonItem
位置が変わりません。このボタンを動かしてバーの右側に配置する方法はありますか?
肖像画:
風景 :
ありがとうございました。
現在の場所の設定は以下をなめると思います:
この設定では、左マージンの長さがランドスケープモードに採用されます。したがって、右マージンの長さを設定し、ボタンにナビゲーションバーの右端を配置させる必要があります。
以下のように設定することをお勧めします。
これらの設定は、サイズインスペクターで編集できます(自分で確認してください)。
私はこのアドバイスであなたの助けになります。
私はこのような問題を解決しました:
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]];
}
そしてそれは動作します:-)