在cocosd-x-2.2.1中例子默认的屏幕方向为水平方向,为了设置屏幕方向为竖直方向,对RootViewController.mm中的下面三个函数进行了修改:
//RootViewController.mm
// Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//return UIInterfaceOrientationIsLandscape( interfaceOrientation );
return UIInterfaceOrientationIsPortrait( interfaceOrientation ); //modified
}
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
//return UIInterfaceOrientationMaskAllButUpsideDown;
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown; //modified
#endif
}
- (BOOL) shouldAutorotate {
//return YES;
return NO; //modified
}
```
但运行后模拟器的方向仍然为水平的,请教各位前辈,要使模拟器方向为竖直方向该怎么修改呢?谢谢了!

