質問

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:]?

役に立ちましたか?

解決

これを試して

if([[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation]==UIInterfaceOrientationLandscapeRight)
{
   //Landscape Frame
}
if([[UIDevice currentDevice] orientation]==UIInterfaceOrientationPortrait)
{
   //Portrait Frame
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top