2.0项目 ios 模拟器竖屏时图像显示问题

虽然看不到图,但我之前也碰到过类似的问题,所以在这里斗胆回答一下。

cocos2d-x默认是横屏显示的,如果要改为默认竖屏显示,
不能用以下语句:

CCDirector::sharedDirector()->setDeviceOrientation(kCCDeviceOrientationPortrait);

用了这条语句,虽然可以使屏幕竖起来,但图像仍然没有竖起来,我猜可能就是楼主所说的现象。

正确的方法是:

在RootViewController.mm中找到shouldAutorotateToInterfaceOrientation()函数,将

return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );

修改为

return (UIInterfaceOrientationIsPortrait(interfaceOrientation));

这样,屏幕和图像便都竖起来了。

受教了, thinks !

虽然看不到图,但我之前也碰到过类似的问题,所以在这里斗胆回答一下。

cocos2d-x默认是横屏显示的,如果要改为默认竖屏显示,
不能用以下语句:

CCDirector::sharedDirector()->setDeviceOrientation(kCCDeviceOrientationPortrait);

用了这条语句,虽然可以使屏幕竖起来,但图像仍然没有竖起来,我猜可能就是楼主所说的现象。

正确的方法是:

在RootViewController.mm中找到shouldAutorotateToInterfaceOrientation()函数,将

return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );

修改为

return (UIInterfaceOrientationIsPortrait(interfaceOrientation));

这样,屏幕和图像便都竖起来了。