GameKit方向问题
当我的应用程序横向运行时(总是如此),我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯...我也遇到了同样的问题..但是我正在使用cocos2d来制作我的游戏..不确定你当前使用的是什么引擎或用于什么目的..
但是对于我的cocos2d..这是我的代码..
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..