2013-05-04 2 views
2

Everyplay를 Cocos2d Game과 통합합니다. 내 게임은 가로 방향 지원 만 지원합니다. iPad에서는 모든 것이 잘 진행됩니다. 하지만 iPhone (iOS6)에서 테스트 할 때 "[[Everyplay sharedInstance] showEveryplay]"를 호출하면 다음과 같은 예외가 throw됩니다. 이유 : '지원되는 방향에는 응용 프로그램과 일반적인 방향이없고 shouldAutorotate가 YES를 반환합니다'Everyplay는 iOS6에서 풍경을 지원합니까?

나는 방향 메커니즘은 내가이 방법을 추가 iOS6.So 변경 알고 :

-(BOOL)shouldAutorotate{ 
    return YES; 
} 
-(NSUInteger)supportedInterfaceOrientations{ 
    return UIInterfaceOrientationMaskLandscape; 
} 
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{ 
     return UIInterfaceOrientationMaskAllButUpsideDown; 
} 

그런 다음 "[[Everyplay sharedInstance] showEveryplay]"예외없이 작동하지만, 내 게임은 내가 원하지 않는 세로 방향을 지원 에.

내 게임의 풍경 만 지원하고 "[[Everyplay sharedInstance] showEveryplay]"는 예외없이 작동하도록하려면 어떻게해야합니까?

답변

0

iPhone Everyplay 웹보기는 항상 세로 모드이지만 iPad에서는 웹보기가 둘 다 지원됩니다. 녹화는 비디오 플레이어처럼 두 가지 모드를 모두 지원합니다. 우리는 가까운 장래에 iPhone 해상도의 가로 모드도 업데이트 할 예정이지만이 작업이 완료되기 전에 약간의 재 설계가 필요할 것입니다.

2

두 가지 방법으로 문제를 해결할 수 있습니다.

옵션 1 :

항목 UIInterfaceOrientationPortrait, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight 및 UIInterfaceOrientationPortraitUpsideDown와 게임의의 Info.plist에 UISupportedInterfaceOrientations 배열을 추가합니다. 지원되는 모든 인터페이스 방향을 프로젝트 요약 페이지에서 확인하거나 info.plist 파일을 수동으로 편집하여 xCode에서 쉽게 수행 할 수 있습니다.

옵션 2 :

는 응용 프로그램의 AppDelegate.m 파일에 다음 메서드를 추가합니다

// IOS 6 

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

를 두 경우 모두 당신이 풍경에 코드를 처리에만 방향을 추가했는지 당신은 또한 확인해야합니다 게임의 주요 UIViewController.

// IOS 5 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation); 
} 

// IOS 6 

- (BOOL)shouldAutorotate { 
    return YES; 
} 

- (NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight; 
} 
+0

옵션 2가 가장 적합합니다. 감사합니다. – user3610913

관련 문제