Изменить ориентацию просмотра в iPhone - PullRequest
0 голосов
/ 28 февраля 2011


Я хочу изменить ориентацию вида по мере его отображения.
Например:
Каждый раз, когда пользователь нажимает кнопку, новый вид отображается для пользователя.Какой бы ни была ориентация, я хочу отобразить этот вид в ландшафтном режиме.
Любые идеи .....

Ответы [ 3 ]

2 голосов
/ 28 февраля 2011

Используйте эту функцию в своем классе.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations

   return (interfaceOrientation == UIInterfaceOrientationLandscapeRight ||                        
   interfaceOrientation == UIInterfaceOrientationLandscapeLeft);

}
2 голосов
/ 28 февраля 2011

Добавьте эту функцию в новом представлении, чтобы изменить ориентацию на ландшафтный режим.

- (BOOL)shouldAutorotateToInterfaceOrientationUIIn terfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );
    } 
0 голосов
/ 28 февраля 2011

Добавьте это к вашему контроллеру представления

- (BOOL)shouldAutorotateToInterfaceOrientationUIIn terfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight );
    } 
...