Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5638] Detect iPhone X with Appcelerator

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusResolved
ResolutionNot Our Bug
Resolution Date2018-03-02T18:31:49.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsios, iphone, x
ReporterKerberos
AssigneeShak Hossain
Created2018-03-02T14:10:48.000+0000
Updated2018-03-05T10:06:41.000+0000

Description

I am using custom navbar for my project and I am using codes for ios 7 top margin as below; {noformat} var _IsIos7Plus = false; if (Titanium.Platform.name == 'iPhone OS') { var _Version = Titanium.Platform.version.split("."); var _Major = parseInt(_Version[0], 10); if (_Major >= 7) { _IsIos7Plus = true; } } {noformat} Alloy.Globals.Ios7TopMargin = _IsIos7Plus == true ? 20 : 0;

Attachments

FileDateSize
Snap1.jpg2018-03-02T14:10:33.000+000011621
Snap2.jpg2018-03-02T14:10:33.000+000010622

Comments

  1. Ewan Harris 2018-03-02

    [~Kerbooo] You can use the following to determine if a device is iPhone X
       var isiPhoneX = (Ti.Platform.displayCaps.platformWidth === 375 && Ti.Platform.displayCaps.platformHeight === 812 && Ti.Platform.displayCaps.logicalDensityFactor === 3);
       
    For example, https://github.com/hansemannn/studentenfutter-app/blob/master/app/alloy.js#L4 Also see AC-5219
  2. Kerberos 2018-03-02

    I tested it simulator but does not work. Because Ti.Platform.displayCaps.platformHeight gives 667
  3. Ewan Harris 2018-03-02

    [~Kerbooo] Check the comments on AC-5219
       The issue is that your launch-screens need to match the new sizes. If you are using storyboards, it will adapt automatically, for the old legacy launch-images, you will need to wait until Apple unblocks TIMOB-25269.
       
  4. Hans Knöchel 2018-03-02

    It shows the overall wrong size because you are missing the correct launch-screens. See [the docs](http://docs.appcelerator.com/platform/latest/#!/guide/Icons_and_Splash_Screens-section-src-29004897_IconsandSplashScreens-iOSgraphicassetrequirementsandoptions) for details: - Default-Portrait-2436h@3x.png - Default-Landscape-2436h@3x.png - OR: Storyboards (recommended by Apple these days, also reduces app-size by ~ 2-4mb)
  5. Kerberos 2018-03-02

    Thank you very much for your support. I have edit (updated) my splah screens it works.

JSON Source