GKAchievementViewController全屏(或PageSheet)奇数显示

发布于 2024-11-28 12:19:40 字数 2194 浏览 2 评论 0原文

我目前正在使用 iPad 并使用 Cocos2D。到目前为止,我只是在处理游戏中心时使用默认视图进行测试。我现在尝试按照自己的需要进行设置,即使用全屏或 PageSheet(如图所示)。

我的问题相当简单(至少在提问时)。它到底为什么要这么做?我不知道如何访问在成就视图之上绘制的“木制”框架。

Example image

这是我一直在使用的代码(包括我一直在尝试的随机内容)以获得更大的视图。

- (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.

Example image

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 技术交流群。

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

发布评论

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

评论(2

司马昭之心 2024-12-05 12:19:40

我只是尝试使用 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.

梦途 2024-12-05 12:19:40

没有太多可用的自定义,如果需要,您将需要获取数据并自行显示。

如果将视图大小设置为 420x512,它将正确显示。

尝试这样的事情:

        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        // The device is an iPad running iPhone 3.2 or later.

        leaderboardController.view.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(90.0f));
        leaderboardController.view.bounds = CGRectMake(0, 0, 420, 512);
        //leaderboardController.view.center = CGPointMake(240, 160);
        leaderboardController.view.center = CGPointMake(364, 512);

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:

        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    {
        // The device is an iPad running iPhone 3.2 or later.

        leaderboardController.view.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(90.0f));
        leaderboardController.view.bounds = CGRectMake(0, 0, 420, 512);
        //leaderboardController.view.center = CGPointMake(240, 160);
        leaderboardController.view.center = CGPointMake(364, 512);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文