iPhone-x full screen support for old projects

iPhone-x full screen support for old projects
0

I just upgraded xcode to latest version 9.1 for iPhone-x testing
Compiled my old game made with cocos2d-x 3.15.1 c++
Game is not coming full screen on iPhone-x


I found github pull request for that : Found here
But it has 64 files changed so it will be difficult for me to integrate into old projects.
So i think we have two options,

  1. wait for 3.17 and upgrade engine, but when it will come out?
  2. Any short ways to add this patch in old projects?
    @dumganhar @slackmoehrle

Also, i think we have to remove that white-line home indicator as well for games. For more details

I don’t think so. Engineers are working on deadlines for new releases. We wont back port this fix.

v3.17 will be released around 2-3 months from now.

Thats big gap.

Yeah, I can see that. Can you try and upgrade a game to GitHub Master? Or is that not an option while v3.17 is being worked on?

We normally use stable release version (zip file), so we cannot upgrade to GitHub.
We develop for clients as well so its easy to manage via zip stable release.
Anyways i found this article , trying to implement that way with old project, if its easy then will do it for all projects.
I think its not that big work, as it says we have to adopt Storyboard instead of Static Launch Images.
I will let you know.

right, I also know this is what devs are doing.

Adding storyboard or launch image will just give u a full resolution of the device. Launch image is possible for iPhone X.

Next you have to fix your UI. Designing for iPhone X

Yes, that i know.

So, engine update has nothing to do with iPhone X, you just need to add LaunchImage 1125 × 2436. Done.

And even, I strongly recommend NOT using storyboards, because you will get full screen of iPad Pro 12.9" - 2048 x 2732px , which is don’t needed actually, because without it adaptation its telln system that its iPad Air and just scale up all using built in iOS system, image looks very good. I bet that Apple do some non linear scaling, so it should better look than getting full canvas and anyway upscaling you game resource. Or you have res for that iPad… I don’t think so.

Ok, can you tell me naming convention for that?

Did you find the solution for this too?

Have you tried? It will just work. Don’t need anything else.


  • (BOOL)prefersHomeIndicatorAutoHidden
    {
    return YES;
    }

I already tried this before, but not working.

I don’t have device lol, can’t help :smiley: maybe it will on the device. BUt I’ve talked about naming convention.

I dont have either.
But Home Indicator should hide on emulator too.
Currently with storyboards game is running in full screen, so i am trying to set everything first like Ads, home-indicator etc
After that i will try with launchimage, but afaik naming convention is very important for it.
Thanks for your help.
I will post here if any solution is working for home-indicator.

Current iOS iPhone X simulator is crap. And other too, works too slow. I never used it since last update to Xcode 9. And this can be just a bug.

Apple solved this issue.

On my Mac, no.

Should use Xcode 9.1.

Yeah, it seems working Okay.

This code we have to add in RootViewController.mm after that its working.
BUT
it just hide the home-indicator, actually we have to disable it.
Means user must swipe twice to go home screen.
But i didnt find solution yet.
@zhangxm Do you find solution for this?

If you haven’t figured it out, this is what I’ve found that seems to work.

- (void)viewDidLoad {
    [super viewDidLoad];
    if (@available(iOS 11.0, *)) {
        // This should only be necessary if you changed the return value of the property
        // `BOOL preferredScreenEdgesDeferringSystemGestures`, but in limited testing needed this
        [self setNeedsUpdateOfScreenEdgesDeferringSystemGestures];
    } else {
        // Fallback on earlier versions
    }
}

// NOTE(steve): meant more for hiding in passive use where touches are infrequent
- (BOOL)prefersHomeIndicatorAutoHidden {
    // NOTE(steve): setting this to yes causes the defer system edge gestures to not work
    //return YES;
    return NO;
}

- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
{
    return UIRectEdgeAll;
    // NOTE(steve): should probably just defer the bottom swipe (home gesture)
    //return UIRectEdgeBottom;
}
4 Likes