2014-02-26 1 views
0

저는 앱 개발 중이며 Xcode 5 개발 중입니다. 앱은 iOS 5에서 iOS 7 지원까지 iPad 용입니다. 나는 plist 및 Project 설정에 정의 된 Landscape Left 및 Right로 응용 프로그램을 제한합니다. 는 또한 클래스Xcode 5에서 iOS 5 용 자동 회전 제한

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||interfaceOrientation == UIInterfaceOrientationLandscapeRight); 
} 
- (NSUInteger)supportedInterfaceOrientations{ 
return UIInterfaceOrientationMaskLandscape; 
} 

에서 앱 위임

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window 
{ 
return UIInterfaceOrientationMaskLandscape; 
} 

코드 로 정의하지만 무슨 일이 있었는지, 그것은 아이폰 OS 7 및 iOS 6에서 잘 작동하지만 항상에서 iOS 5 장치 이동 세로로 회전. 나는 풍경에서만 이것을 제한하는 방법을 여기에 붙어있다. 친절하게 도와주세요. 미리 감사드립니다.

답변

0

U 방향 변경을 잠글 수 있습니다.

- (BOOL)shouldAutorotate 
    { 
     if (autoRotate) { 
     return YES; 
     } 
     else 
     { 
     return NO; 
     } 
    } 
+0

iOS 5가 아닌 ... – iPatel

+0

예 ... 6.0 이후 사용 중지되었습니다. – KethanKumar

+0

죄송합니다. !!!! :( – josh

0

세로 방향으로 회전되지 않는 코드 위에 장치되어 사용하여 코드

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
     return YES; 
    else 
     return NO; 
} 

을 다음과 같이하십시오.

+0

감사합니다 @iPatel, 회전 중에 호출하지 않는이 메서드를 구현하지만 컨트롤러가 한 번로드 될 때 호출합니다. – josh

+0

@josh - 위 프로젝트의 코드를 사용합니다.) – iPatel

+0

당신은 그렇게 생각하지 않습니다, 이것은 장치의 문제 일 수 있습니다. 내가 모든 일을했기 때문에 나머지 장치에서도 잘 작동했기 때문에? 당신의 경험이 말하는 것은 가능합니까? – josh