CCDirector setDeviceOrientation into cocos2d v2.0rc1

时间:2012-05-21 15:55:31

标签: cocos2d-iphone

在我的应用程序中更新我的cocos2d 1.0.1到2.0rc1之前,我正在调用[[CCDirector sharedDirector] setDeviceOrientation:(ccDeviceOrientation)currentOrientation];在一些场景中检测到一个方向变化,然后根据当前方向加载其他场景的肖像或景观。

但现在我对如何做到这一点一无所知。

2 个答案:

答案 0 :(得分:2)

Orientation setOrientation ( Orientation orientation )
CCDirector回调更改设备方向。

CCDirector希望改变的方向的定义。

返回 应用程序的实际方向。

答案 1 :(得分:1)

打开AppDelegate.m并找到此方法:

// Supported orientations: Landscape. Customize it for your own needs
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

为您的应用支持的所有方向返回YES。