读书人

设立屏幕方向

发布时间: 2013-07-16 22:38:05 作者: rapoo

设置屏幕方向

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

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

return UIInterfaceOrientationIsLandscape( interfaceOrientation );

//肖像模式(竖屏)

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

?return YES;

读书人网 >移动开发

热点推荐