无法在cocos3d中更改场景的屏幕方向

时间:2014-12-01 12:04:43

标签: ios objective-c cocos3d

我有一个视图控制器,其中显示了一些cocos3d内容。在我的appDelegate中:

+(CC3DeviceCameraOverlayUIViewController *)panoramaHostController {
static CC3DeviceCameraOverlayUIViewController *panoramaHostController = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
    panoramaHostController = CC3DeviceCameraOverlayUIViewController.sharedDirector;
    panoramaHostController.supportedInterfaceOrientations = UIInterfaceOrientationMaskAll;
    panoramaHostController.viewShouldUseStencilBuffer = NO;     // Set to YES if using shadow volumes
    panoramaHostController.viewPixelSamples = 1;                    // Set to 4 for antialiasing multisampling
    panoramaHostController.animationInterval = (1.0f / 60.0f);
    panoramaHostController.displayStats = NO;
    [panoramaHostController enableRetinaDisplay: YES];
});
return panoramaHostController;
}

并在panoramaHostController中以这种方式初始化场景:

-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

//
if (!sceneInitialized) {
    sceneInitialized = YES;

    CC3Layer *axPanoramaLayer = [AxPanoramaLayer layer];
    axPanoramaLayer.contentSize =  [CCDirector sharedDirector].winSize;

    [CCDirector.sharedDirector runWithScene: [axPanoramaLayer asCCScene]];
}
else {
    [[AppDelegate panoramaHostController] resumeAnimation];
}

[self.view addSubview: CCDirector.sharedDirector.view];
...
}

但是当我旋转设备时 - 内容保持不变。这有什么不对?

0 个答案:

没有答案