gpt4 book ai didi

iphone - ios<= 6 中的 cocos2d 方向问题

转载 作者:行者123 更新时间:2023-11-29 04:11:30 25 4
gpt4 key购买 nike

我开发了一款游戏,仅支持 iOS 4.3 以上设备的横向模式。该应用程序实现了游戏中心,但在 iOS 6 设备上测试期间崩溃了,因为游戏中心登录屏幕不支持 iOS 6 中的横向模式。所以我解决了将以下代码添加到 appdelegate.m 中的问题并开始工作,但现在应用程序在 ios6(ios5 等)以下的设备上显示完全有线(显示纵向颠倒)

-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
return UIInterfaceOrientationMaskAll;
else // iphone
return UIInterfaceOrientationMaskAllButUpsideDown;
}

使用代码:4.5cocos2d v1.0.1

请帮我解决这个问题

最佳答案

在您的项目中添加给定的类

GKMatchmakerViewController-LandscapeOnly.h

#import <Foundation/Foundation.h>
#import <GameKit/GameKit.h>

@interface GKMatchmakerViewController(LandscapeOnly)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
@end

GKMatchmakerViewController-LandscapeOnly.m


#import "GKMatchmakerViewController-LandscapeOnly.h"

@implementation GKMatchmakerViewController (LandscapeOnly)

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );
}

@end

关于iphone - ios<= 6 中的 cocos2d 方向问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14333868/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com