2011-02-14 3 views
0

첫 번째보기를 세로보기 모드로 변경하고 두 번째보기를 가로보기 모드로 변경하려면 gameconfig.h 파일을 사용하고 있습니다.뷰를 세로 모드에서 가로 모드로 변경하려면 어떻게해야합니까?

코드는 다음과 같습니다 내가 세로 모드에서 메뉴를 표시 할 첫 번째보기에서

// 
// GameConfig.h 
// Cocos2DSimpleGame 
// 
// Created by Ray Wenderlich on 11/21/10. 
// Copyright Ray Wenderlich 2010. All rights reserved. 
// 

#ifndef __GAME_CONFIG_H 
#define __GAME_CONFIG_H 

// 
// Supported Autorotations: 
//  None, 
//  UIViewController, 
//  CCDirector 
// 
#define kGameAutorotationNone 0 
#define kGameAutorotationCCDirector 1 
#define kGameAutorotationUIViewController 2 //2 
// 
// Define here the type of autorotation that you want for your game 
// 
#define GAME_AUTOROTATION kGameAutorotationUIViewController 


#endif // __GAME_CONFIG_H 


and in my appDelegate file is: 
#if GAME_AUTOROTATION == kGameAutorotationUIViewController 
    [director setDeviceOrientation:kCCDeviceOrientationPortrait]; 
#else 
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]; 

    //[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]; 
// [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]; 
#endif 

, 나는 새로운 게임을 클릭 할 때 또한 다음 게임은 가로 모드로 표시됩니다. 나는 shouldAutoInterfaceOrientation도 사용하지만 해결책을 찾지 못했습니다. 당신이 방향을 변경하고자 할 때

+0

코드를 형식화하십시오. 이렇게 읽는 건 정말 어렵습니다 ... –

답변

0

은 세로 모드입니다 보기가 가로 모드로 표시 될 값을 변경합니다. 제안 사항을 알려 주신 thnx

1

,이 함수를 호출 : 나는 한 방향으로 그 값을 변경할 때마다 내가 쉽게 #DEFINE kGameAutorotationUIViewController 2보기의 도움으로 내 문제를 해결

[[CCDirector sharedDirector]setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]; 
관련 문제