Это должно казаться очевидным и простым, но это не для меня и кажется более запутанным, чем вы думаете на первый взгляд.
GameConfig.h шаблона Cocos2d Я установил следующее:
#if defined(__ARM_NEON__) || TARGET_IPHONE_SIMULATOR
#define GAME_AUTOROTATION kGameAutorotationNone
// ARMv6 (1st and 2nd generation devices): Don't rotate. It is very expensive
#elif __arm__
#define GAME_AUTOROTATION kGameAutorotationNone
// Ignore this value on Mac
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
#else
#error(unknown architecture)
#endif
В приложении Delegate applicationDidFinishLaunching
У меня есть это:
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endif
В RootViewController shouldAutorotateToInterfaceOrientation
:
#if GAME_AUTOROTATION==kGameAutorotationNone
//
// EAGLView won't be autorotated.
// Since this method should return YES in at least 1 orientation,
// we return YES only in the Portrait orientation
//
return ( interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
Итак, несмотря на то, что все условия для kGameAutorotationNone
установлены на UIInterfaceOrientationLandscapeLeft
, что я вижу? Портрет.
Что странно, так это то, что я могу видеть Пейзаж Левый, если я вместо этого shouldAutorotateToInterfaceOrientation
to:
#if GAME_AUTOROTATION==kGameAutorotationNone
//
// EAGLView won't be autorotated.
// Since this method should return YES in at least 1 orientation,
// we return YES only in the Portrait orientation
//
return ( interfaceOrientation == UIInterfaceOrientationPortrait);
Может кто-нибудь помочь мне понять, что здесь происходит?