iPad에서 가로보기 만 지원하는 viewcontroller와보기가 있습니다.iOS가 특정보기에서 회전을 방지합니다.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait)
return NO;
else
return YES;
}
하지만 초상화가 있어야하는 영화 플레이어가있는보기가 있습니다. 그래서이보기에 나는이 작업을 수행 :
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait)
return YES;
else
return NO;
}
내 문제는 내가, NO에 대한 첫 번째의 ViewController 세트 초상화, 다음 내 두 번째 뷰 컨트롤러가 세로로 회전하지 않을 경우이다. secondviewcontroller는 첫 번째 뷰의 하위 뷰로 추가됩니다. 보기 1을 세로 방향으로 회전시키지 않고보기 2를 가로 방향으로 회전시키지 않으려면 어떻게해야합니까? 이 응용 프로그램은 데모 목적을위한 것이므로 정말이 질문에 대한 기술적 대답을 찾고 있습니다.
나는 100 % 확신 할 수는 없지만 이미 해킹 된 솔루션에 대해 이야기하고 있으므로 [UIScreen setStatusBarOrientation : animated :]를 사용하여 장치의 회전을 직접 설정할 수 있다고 생각합니다. 나는 그것을 한번도 시도한 적이 없으며 문서에 몇 가지 무서운 경고가있어 최선의 생각이 아닐 수도 있습니다 ... –
True ... 그 방법에 대해서도 읽었습니다. 하지만 당신이 말했듯이, 이것은 해킹이 지금은 작동 할 수 있습니다 데모입니다;) – shawnwall
고마워. 그리고 setStatusBarOrientation과 [[UIDevice currentDevice] setOrientation :]은 shouldAutoRotate 속성을 오버라이드 할 수 없습니다. – spentak