The API “display.screenOriginX” and “display.screenOriginY” works fine with Simulator and Android builds. However it can’t return correct values for iOS build by iOS 10.3 SDK.
The following 3-files simple sample project shows the error.
1. config.lua
application = {
content = {
width = 320,
height = 480,
scale = “letterBox”,
fps = 30,
},
}
2. build.settings
settings = {
orientation = {
default = “portrait”,
supported = { “portrait”, }
},
iphone = {
plist = {
}
},
}
main.lua
display.setStatusBar( display.HiddenStatusBar )
display.setDefault(“background”, 0, 0, 0)
local txt_1 = display.newText("display.screenOriginX: "…display.screenOriginX, 0, 0, native.systemFont, 15)
txt_1.x = display.contentCenterX
txt_1.y = display.contentCenterY - 20
local txt_2 = display.newText("display.screenOriginY: "…display.screenOriginY, 0, 0, native.systemFont, 15)
txt_2.x = display.contentCenterX
txt_2.y = display.contentCenterY + 20
In simulator with iPhone5 selected, it shows that display.screenOriginY equals -44, which is correct.
However, if the iOS build is run by an iPhoneSE device, it shows that display.screenOriginY equals -0
As I know, this problem occurs only with new iOS 10.3 build, which happens no matter I used Corona-3068 or Corona-3100.
Is this a Corona bug, or I missed something in my code?