【发布时间】:2011-02-14 15:53:33
【问题描述】:
我想将第一个视图更改为纵向模式,第二个视图进入横向模式,我正在使用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,但是没找到解决办法。
【问题讨论】:
-
请格式化您的代码。像这样读起来真的很难……
标签: iphone cocos2d-iphone