質問

私は簡単なUIViewControllerを使用したXIB、そのインタフェース。

など、インターフェースだけで構成されるUIView、UIActivityIndicator、UILabel.私のサイジング制約のインターフェイスをビルダーセットの活動指標およびラベルの中心のビューが回転します。

のUIViewController設定に戻したり肖像画、風景の向きに -shouldAutorotateToInterfaceOrientation: 方法。

のビューが追加され、ビュー階層を手動で使用し、

if (!activityOverlay)
    activityOverlay = [[XBActivityOverlayViewController alloc] initWithNibName:@"XBActivityOverlayViewController" bundle:nil message:@"Connecting..."];

[activityOverlay.view setAlpha:0.0f];
[self.window addSubview:activityOverlay.view];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3f];
[activityOverlay.view setAlpha:0.9f];
[UIView commitAnimations];

の問題なんでた場合には、デバイスは既に横の階層に追加され、この時点ではまだ縦置きで使用できませんの自動回転が行えます。

いが必要なの追加、ビューの方向として、親会社のとおりです。

役に立ちましたか?

解決

わからない場合には不明な点があれば、ここでお答えしていますが、なんとかです:

私にとって、毎回の追加と解任のモーダルまたは表示アイデンティティーの再発見、以下の関数が呼び出される:

-(void) detectOrientation 
{


 if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) || 
     ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) 
 {

             item1.frame = CGRectMake(147.0, 241.0, 56.0, 28.0);
     item2.frame = CGRectMake(265.0, 241.0, 56.0, 28.0);

 }
 else if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait) ||
          ([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown) || !inLandscapeOrientation)
 {

    item1.frame = CGRectMake(35.0, 425.0, 35.0, 28.0);
item2.frame = CGRectMake(176.0, 425.0, 35.0, 28.0);
 }

}

ここで変更したい位置に、現在のデバイスに向かう。その場合の検出は、電流の向きは風景を追加すsubviewることはない。

Alejandra:)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top