我想在縱向模式下更改第一個視圖,並且第二個視圖進入橫向模式,我正在使用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
,但我還沒有找到解決方案。
請格式化您的代碼。像這樣閱讀真的很難...... – 2011-02-14 16:21:03