GKAchievementViewController全屏(或PageSheet)奇数显示
我目前正在使用 iPad 并使用 Cocos2D。到目前为止,我只是在处理游戏中心时使用默认视图进行测试。我现在尝试按照自己的需要进行设置,即使用全屏或 PageSheet(如图所示)。
我的问题相当简单(至少在提问时)。它到底为什么要这么做?我不知道如何访问在成就视图之上绘制的“木制”框架。
这是我一直在使用的代码(包括我一直在尝试的随机内容)以获得更大的视图。
- (void)showAchievements:(id)sender
{
GKAchievementViewController *achievements = [[GKAchievementViewController alloc] init];
if (achievements != nil)
{
achievements.achievementDelegate = self;
tempVC = [[UIViewController alloc] init];
// tempVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// tempVC.interfaceOrientation = [[UIDevice currentDevice] orientation];
[achievements shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft];
[achievements shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
[tempVC shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft];
[tempVC shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
// achievements.navigationController.modalPresentationStyle = UIModalPresentationPageSheet;
// tempVC.wantsFullScreenLayout = YES;
tempVC.modalPresentationStyle = UIModalPresentationPageSheet;
tempVC.view.superview.bounds = CGRectMake(0, 0, winSize.width, winSize.height);
// tempVC.view.superview
// tempVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
// achievements.wantsFullScreenLayout = YES;
achievements.modalPresentationStyle = UIModalPresentationPageSheet;
// achievements.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
achievements.navigationController.modalPresentationStyle = UIModalPresentationPageSheet;
// achievements. = CGRectMake(0, 0, winSize.width, winSize.height);
[[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view];
[tempVC presentModalViewController:achievements animated:YES];
}
}
我对 UIKit 的理解极其有限。我使用 Cocos2D 和 Box2D,几乎没有使用其他东西(至少到目前为止)。请您提供任何帮助,我们将不胜感激。如果您可以简单地向我展示如何正确完成此操作(没有我在那里的所有垃圾代码),那就完美了。
谢谢 :)
I am working with the iPad at the moment and am using Cocos2D. Up until now I have just been testing with the default view when dealing with Game Center. I am attempting to now set it up as I want it, which is using either full screen or PageSheet (which is shown in the image).
My question(s) is fairly simple (at least in the asking). Why exactly is it doing that? I can not figure out how to access that "wooden" frame that is drawing over top of achievement view.
Here is the code I have been using (including random stuff I have been trying) to get to a bigger view.
- (void)showAchievements:(id)sender
{
GKAchievementViewController *achievements = [[GKAchievementViewController alloc] init];
if (achievements != nil)
{
achievements.achievementDelegate = self;
tempVC = [[UIViewController alloc] init];
// tempVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// tempVC.interfaceOrientation = [[UIDevice currentDevice] orientation];
[achievements shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft];
[achievements shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
[tempVC shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft];
[tempVC shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
// achievements.navigationController.modalPresentationStyle = UIModalPresentationPageSheet;
// tempVC.wantsFullScreenLayout = YES;
tempVC.modalPresentationStyle = UIModalPresentationPageSheet;
tempVC.view.superview.bounds = CGRectMake(0, 0, winSize.width, winSize.height);
// tempVC.view.superview
// tempVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
// achievements.wantsFullScreenLayout = YES;
achievements.modalPresentationStyle = UIModalPresentationPageSheet;
// achievements.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
achievements.navigationController.modalPresentationStyle = UIModalPresentationPageSheet;
// achievements. = CGRectMake(0, 0, winSize.width, winSize.height);
[[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view];
[tempVC presentModalViewController:achievements animated:YES];
}
}
My understanding of UIKit is extremely limited. I use Cocos2D and Box2D and pretty much nothing else (up until now anyway). Please, any help you can provide will be very much appreciated. If you could simply show me how this would be done properly (without all the junk code I have in there) that would be perfect.
Thank you :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我只是尝试使用 UIModalPresentationPageSheet 执行此操作,我看到了相同的结果,不仅仅是您。执行此操作的“正确”方法不是更改模式视图的大小! :) Apple 的 UI 设计师已经选择了他们想要的演示风格和样式。成就视图的大小;为了游戏之间的一致性,最好不要搞乱这一点。
I just tried to do this with UIModalPresentationPageSheet and I see the same result, it's not just you. The "correct" way to do this is not to change the size of the modal view! :) Apple's UI designers have chosen their desired presentation style & size of the achievements view; it's best not to mess with that, for consistency between games.
没有太多可用的自定义,如果需要,您将需要获取数据并自行显示。
如果将视图大小设置为 420x512,它将正确显示。
尝试这样的事情:
There isn't much customization available with this, you will need to get the data and display it yourself if you want that.
If you size the view to 420x512, it will display correctly.
Try something like this: