Вопрос

У меня есть UIrextfield в UialertView. Когда ориентация меняется, я хочу обновить раму UIrexfieldfield, потому что в противном случае он будет пересекать кнопки UiAlertView. Это рамки:

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