How to identify iPhone X

Getting into LiveCode for iOS? Ask your questions here.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am
Location: Olympia, WA USA

How to identify iPhone X

Post by JackD » Thu Mar 01, 2018 2:43 am

I've been looking at modifying an app to be iPhone X friendly by avoiding the safe areas at the top & bottom of a portrait screen. An app can run in compatibility mode but only if it is approved within the next month. Is there another way to identify an iPhone as model X other than checking the screen resolution (screenRect) which seems rather arbitrary? mergDeviceName() returns whatever a person has named their device and "the machine" simply returns iPhone.
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

hlowe
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4
Joined: Wed Dec 05, 2012 5:56 am

Re: How to identify iPhone X

Post by hlowe » Sun Mar 18, 2018 6:46 am

Try this:

Function isIPhoneX
local tIsiPhoneX,tScreenRect,tScreenHeight,tScreenWidth
put false into tIsiPhoneX
put the ScreenRect into tScreenRect
if word 1 of the machine is "iPhone" and MobilePixelDensity() = 3 then
put item 3 of tScreenRect into tScreenWidth
put item 4 of tScreenRect into tScreenHeight
if (tScreenWidth = 375 and tScreenheight = 812) or (tScreenWidth = 812 and tScreenheight = 375) then
put true into tIsiPhoneX
end if
end if
return tIsiPhoneX
end isIPhoneX

JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am
Location: Olympia, WA USA

Re: How to identify iPhone X

Post by JackD » Sun Mar 18, 2018 7:00 am

Thanks, hlowe
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

Post Reply

Return to “iOS Deployment”