设置屏幕方向

在Appdelegate.ccp的bool AppDelegate::applicationDidFinishLaunching()函数中setDeviceOrientation(CCDeviceOrientationPortrait);设置的只是屏幕的方向,但显示内容依旧是横屏的。

 
还需要在RootViewController.mm中的 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation函数返回bool值
//设置风景模式(横屏 默认)

return UIInterfaceOrientationIsLandscape( interfaceOrientation );

//肖像模式(竖屏)

return UIInterfaceOrientationIsPortrait( interfaceOrientation );
//横竖屏都支持

 return YES;

猜你喜欢

转载自3895177.iteye.com/blog/1905335
今日推荐