2012-12-14 1 views
0

IOS 5 용으로 제작 된 내 응용 프로그램에서 가로 방향을 제거하고 싶습니다. IOS 6에서 이것이 가능하다는 것을 알았지 만 이전 버전에서는 나에게 도움이되지 않습니다.IOS5에서 가로 방향 사용 안 함

plist 파일에 세로 방향 (세로 홈 단추 및 세로 홈 홈 단추)이 두 방향으로 설정되어 있습니다. 그럼에도 불구하고 풍경은 여전히 ​​IOS 5에서 수확됩니다.

이 문제가 발생하지 않도록하려면 더 많은 조치가 필요합니까?

답변

1
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations 
    // return (interfaceOrientation == UIInterfaceOrientationPortrait); 
    if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
{ 
    return NO; 
} 
else 
{ 
    return YES; 
} 

} 

쓰기 iOS5를 놓았을하는 .m 파일에이 코드

날이 여부를 작동 알려 ....

코딩 해피 !!!!

+0

작동하지 않습니다. – venkat

0

이렇게하면됩니다. 스토리 보드로 이동하여보기 컨트롤러에서 원하지 않는 방향을 선택 취소하고 다음 코드를 작성하십시오.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation==UIInterfaceOrientationPortrait); 
} 
+0

IOS에서 작동하지 않습니다. 5. 가로 방향을 어떻게 비활성화 할 수 있습니까? 저에게 도움이 될 수 있습니다. 감사합니다. – venkat