在我的应用程序中将我的 cocos2d 1.0.1 更新为 2.0rc1 之前,我正在调用 [[CCDirector sharedDirector] setDeviceOrientation:(ccDeviceOrientation)currentOrientation]; 当检测到方向上的一个变化时进入某些场景,然后根据 currentOrientation 以纵向或横向加载其他场景。
但现在我不知道我该怎么做。
在我的应用程序中将我的 cocos2d 1.0.1 更新为 2.0rc1 之前,我正在调用 [[CCDirector sharedDirector] setDeviceOrientation:(ccDeviceOrientation)currentOrientation]; 当检测到方向上的一个变化时进入某些场景,然后根据 currentOrientation 以纵向或横向加载其他场景。
但现在我不知道我该怎么做。
Orientation setOrientation ( Orientation orientation )
CCDirector 回调以更改设备方向。
CCDirector 想要更改的方向的定义。
返回 应用程序的实际方向。
打开 AppDelegate.m 并找到这个方法:
// Supported orientations: Landscape. Customize it for your own needs
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
为您的应用支持的所有方向返回 YES。