Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS 8+中的横向模式;显示不正确_Ios_Objective C_Iphone_Cocos2d Iphone - Fatal编程技术网

iOS 8+中的横向模式;显示不正确

iOS 8+中的横向模式;显示不正确,ios,objective-c,iphone,cocos2d-iphone,Ios,Objective C,Iphone,Cocos2d Iphone,我有两款比较老的Cocos2d游戏,在更新时,我注意到它们在发布时被截断了。在StackOverflow上找到其他答案后,我仍然有一些问题 我目前使用的解决方法是 我正在使用的AppDelegate.m内部 CGAffineTransform transform = CGAffineTransformMakeRotation(1.57079633); navController_.view.transform = transform; 并将设备方向设置为纵向&纵向向上向下-即使游戏是横

我有两款比较老的Cocos2d游戏,在更新时,我注意到它们在发布时被截断了。在StackOverflow上找到其他答案后,我仍然有一些问题

我目前使用的解决方法是

我正在使用的
AppDelegate.m
内部

CGAffineTransform transform = CGAffineTransformMakeRotation(1.57079633);
    navController_.view.transform = transform;
并将设备方向设置为纵向&纵向向上向下-即使游戏是横向的。 这是一个肮脏的修正,并带来了它自己的一套问题,如UIAlert视图没有出现在正确的方向,以及屏幕没有旋转的风景颠倒(除非你把它向上拿),这会让人困惑,而且相当肯定这是违反苹果的审查规则,只是使整个解决办法真的无用

实际上,我需要欺骗它,以便我可以启用横向模式而不是纵向模式,但在启动时旋转屏幕,有人成功地做到了这一点吗

  • 将此添加到AppDelegate.m类中

    • (UIInterfaceOrientationTask)应用程序:(UIApplication*)应用程序支持InterfaceOrientationsforWindow:(UIWindow*)窗口的接口方向 { 返回UIInterfaceOrientationMaskLandscape; }
  • 项目文件->目标->选择您的横向方向


  • 没什么区别,两种选择?您希望应用程序以横向模式启动,对吗?您使用的是什么XCode版本?8.2.1,您给我的代码也显示了黄色错误<代码>执行“应用程序”时返回类型冲突;supportedInterfaceOrientationsForWindow:UIInterfaceOrientationMask(又名“enum UIInterfaceOrientationMask”)与“NSInteger(又名unsigned int)”没有区别,我认为这个问题与COCOS2D在横向中识别屏幕尺寸有关