0

私はUIAlertViewにUITextFieldを持っています。オリエンテーションが変わると、UITextFieldのフレームを更新する必要があります。これは、UIAlertViewのボタンとオーバーラップするためです。これらは、フレームです:フレームはインターフェイスの向きに合わせて

portrait: CGRectMake(12.0, 45.0, 260.0, 26.0) 
landscape: CGRectMake(12.0, 30.0, 260.0, 26.0) 

デバイスの向きが直接加速度計を使用してずにを変更した場合、私がチェックすることができますどのように?

-[UIViewController shouldAutorotateToInterfaceOrientation:]にする必要がありますか?

答えて

2

はいこの

if([[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeRight) 
{ 
    //Landscape Frame 
} 
if([[UIDevice currentDevice] orientation]==UIInterfaceOrientationPortrait) 
{ 
    //Portrait Frame 
} 
+0

を試してみて、それが実際に回転したときにどのように私のアプリを知っているのですか? –

+0

デバイスをローテーションすると、このデリゲートが呼び出されます。 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { – iPrabu

関連する問題