0

UIAlertView に UITextField があります。向きが変わったら、UIAlertView のボタンと重なってしまうので、UITextField のフレームを更新したいと思います。これらはフレームです:

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

加速度計を直接使用せずに、デバイスの向きが変更されたかどうかを確認するにはどうすればよいですか?

にあるはず-[UIViewController shouldAutorotateToInterfaceOrientation:]ですか?

4

1 に答える 1

2

これを試して

if([[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeRight)
{
   //Landscape Frame
}
if([[UIDevice currentDevice] orientation]==UIInterfaceOrientationPortrait)
{
   //Portrait Frame
}
于 2010-12-11T11:48:30.860 に答える