Fork me on GitHub

cocos2d/box2d技术问题汇总

 任何一门技术,在学习的时候都会遇到各种各样的问题,有些很初级,有些比较诡异。而且有一个特点,就是大部分人在学习过程中遇到的问题都差不多。所以,本贴的目的就是建立一个常见问题的汇总贴,把我学习过程中,网友在博客上的提问,还有群里面的问题,以FAQ的形式整理出来,供大家参考。如果大家发现存在什么问题,或者某个问题有更好的解决办法的话,欢迎留言指出。

 

FAQ NO.1:

Q:新建一个cocos2d项目,如果把横版改成竖版?

A:

      在RootViewController.m里面,

      在shouldAutorotateToInterfaceOrientation:方法里面,

     找到#elif GAME_AUTOROTATION == kGameAutorotationUIViewController这个宏判断
      然后把 return (UIInterfaceOrientationIsLandscape(interfaceOrientation));
      改成
  return (UIInterfaceOrientationIsPortrait(interfaceOrientation));

  补充:有网友提出此方法只在4.3的系统生效,如果是3.13的系统,还得在AppDelegate.m里面做如下修改: 

#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endif
//这一行是要添加的代码
[director setDeviceOrientation:kCCDeviceOrientationPortrait];



posted on 2012-03-10 20:05  pengyingh  阅读(330)  评论(0编辑  收藏  举报

导航