newRect position on screen

Dear All,

Please could you give some pointers on the following:

headerBox = display.newRect( display.contentWidth \* 0.5, 20, display.contentWidth - 0, 40, 12) headerBox.strokeWidth = 0 headerBox:setFillColor(50/255, 50/255, 150/255) headerBox:setStrokeColor(255, 255, 255)

When using this, the idea is to position it at ‘20’ from the top, and with a box height of 40, it should align with the upper edge of the screen, and therefore be the header section of the app.

However, the position of the box from the upper edge of the screen is varying from device to device. Its at the upper edge (as desired) on iphone4 but a bit lower on Nexus4 and considerably lower in Galaxy S4. 

Any pointers please? 

Cheers,

Anshuman

I’m almost certain that the reason is screen size vs physical size. To counter this please use: https://docs.coronalabs.com/api/library/display/screenOriginX.html

Thanks Piotrz55!

Works like a charm, many thanks.

I’m almost certain that the reason is screen size vs physical size. To counter this please use: https://docs.coronalabs.com/api/library/display/screenOriginX.html

Thanks Piotrz55!

Works like a charm, many thanks.