GameKit方向问题

发布于 2024-10-18 12:16:49 字数 626 浏览 2 评论 0原文

当我的应用程序横向运行时(总是如此),我的 GameKit 视图出现问题 - 如果我以纵向握住手机,GameKit 视图会出现在屏幕外,如果我以横向视图握住它,它会出现侧面向上,即,它自己的横向模式,但与调用视图控制器的呈 90 度。我几天来一直在尝试寻找解决方案,唯一有效的方法(只要用户将手机保持横向)是 -

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

其次是 -

leaderboardController.view.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(0.0f));
[leaderboardController.view setCenter:CGPointMake(240, 160)];

问题是,如果用户将手机保持纵向,游戏中心再次以 90 度的角度出现,并以自己的肖像模式显示。帮助!任何智慧的话语都非常感激。

When my app runs in landscape (which it always does) I have problems with the GameKit view - if I hold the phone in portrait orientation, the GameKit view appears offscreen, if I hold it in landscape view it appears sideways up, ie, in its own landscape mode but at 90 degrees to the calling view controller's. I've been trying to find solutions for days, the only thing which works (as long as the user keeps the phone in landscape orientation) is -

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

followed by -

leaderboardController.view.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(0.0f));
[leaderboardController.view setCenter:CGPointMake(240, 160)];

Trouble is, if the user holds the phone in portrait orientation, the Game Center appears at 90 degrees again, in its own portrait mode. Help! Any words of wisdom greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沫离伤花 2024-10-25 12:16:49

嗯...我也遇到了同样的问题..但是我正在使用cocos2d来制作我的游戏..不确定你当前使用的是什么引擎或用于什么目的..

但是对于我的cocos2d..这是我的代码..

mmvc.view.transform = CGAffineTransformMakeRotation( CC_DEGREES_TO_RADIANS( 90.0f ) );
mmvc.view.bounds = CGRectMake(0, 0, 480, 320);

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight];

Hmm... i had the same problems too.. But i was using cocos2d to make my game.. Not sure what engine you are currently using or for what purpose..

But for my cocos2d.. here's my code..

mmvc.view.transform = CGAffineTransformMakeRotation( CC_DEGREES_TO_RADIANS( 90.0f ) );
mmvc.view.bounds = CGRectMake(0, 0, 480, 320);

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文