[CRITICAL] Build 2012.840+ - native.newTextField do not position correctly on Retina displays ( ?_? )

– This bug ONLY affects Apple iOS RETINA displays (AFAIK) –

Manifests when NOT using scaling. Works fine in Corona Simulator, all devices. Unfortunately, using scaling isn’t an option. Did not manifest on any android device tested on.

Simply put this into a main.lua file and build it and watch as the bouncing boxes mock your desire to put a textField on the screen where you want it once you build it.

Observe the differences between the Corona simulator (Mac, of course) and the results on the device or in the xCode simulator. Tested on iPod Touch 4th gen & New iPad.

Works fine in xCode simulator for iphone.
But bug manifests in xCode simulator for iPhone (Retina).

[code]

local tfWidth = (display.contentWidth/2)
local tfHeight = display.contentHeight/12

tf1 = native.newTextField(
50,
50,
tfWidth,
tfHeight
)

tf2 = native.newTextField(
50,
display.contentCenterY,
tfWidth,
tfHeight
)

tf1:setReferencePoint(display.CenterLeftReferencePoint)
tf2:setReferencePoint(display.CenterLeftReferencePoint)

local function bounce1()
transition.to(tf1, {time=3000, x = display.contentCenterX})
transition.to(tf1, {time=3000, delay=3000, x=50,onComplete=bounce1})
end

local function bounce2()
transition.to(tf2, {time=3000, y = display.contentCenterY - 150 })
transition.to(tf2, {time=3000, delay=3000, y = display.contentCenterY,onComplete=bounce2})
end

bounce1()
bounce2()

[/code] [import]uid: 13784 topic_id: 29940 reply_id: 329940[/import]

@marble68, I use native.newTextField objects, so I would want to know if there’s a problem positioning them on device.

As far as I am aware, all of my native.newTextField objects appear & position as expected on iPhone retina and New iPad devices (mirroring exactly how I see them on Corona Simulator – and I viewed every iOS device type available on simulator.)

I run your code on simulator but I haven’t built it to test it on device. Do you mind explaining how it changes on device?

Naomi

Edit: In my case, I use letterbox scaling in config.lua, with width = 320 and height = 480 (although you mentioned scaling isn’t a solution or workaround, I thought I’d mention this anyhow.) [import]uid: 67217 topic_id: 29940 reply_id: 120090[/import]

Naomi - do you use corona scaling? If so, remove that. Simply rename your build.settings.

Use native x y positioning. Of note, this does NOT manifest on the xCode simulator for iPhone or iPad, only iPad Retina (iphone 4)

It doesn’t manifest in Corona Simulator, but will on XCode simulator if you pick a retina display.

I have tested this on the XCode simulator and 5 physical devices.
New iPad (retina)
iPod Touch (retina)
Epic 4G (android 2.3)
Samsung Galaxy Tab (android 2.3)
Transformer TF101 (android 4.0)

It only manifests on the two physical retina devices or in the xcode simulator when I pick retina hardware.

[import]uid: 13784 topic_id: 29940 reply_id: 120091[/import]

I am hoping someone who is on the current ‘release’ can test this and confirm if they see it there, too. [import]uid: 13784 topic_id: 29940 reply_id: 120092[/import]

Correct, turning on scaling introduces all kinds of challenges - especially that I’m over 8 months into this project. [import]uid: 13784 topic_id: 29940 reply_id: 120095[/import]

Scaling is great but there are advantages to NOT using it. [import]uid: 13784 topic_id: 29940 reply_id: 120096[/import]

Retro tested to 840, but exists there, too.

[----------- EDIT -----------]
[I have updated the title to reflect that the bug exists all the way back to 840 (the oldest I’ve tested)] [import]uid: 13784 topic_id: 29940 reply_id: 120079[/import]

I’m on XCODE 4.4.1, OSX 10.7.4 64bit.
[import]uid: 13784 topic_id: 29940 reply_id: 120074[/import]

Ah okay, I use scaling, so I don’t see the problem you are having. You might want to submit a bug report (with a project that doesn’t include build.settings), and explain why you need it to work?

Naomi [import]uid: 67217 topic_id: 29940 reply_id: 120103[/import]

Well, the forum says to post them here and to use the link in the sticky:

http://developer.coronalabs.com/project/issues/

But that link doesn’t work, so… Hopefully, someone who works for Corona will see this and think “oh, that’s an easy fix”.

But there’s the report a bug link so, it’s filed here: http://developer.coronalabs.com/content/bug-submission


[import]uid: 13784 topic_id: 29940 reply_id: 120104[/import]

This problem is because Corona is using pixels where it should be using points. This means everything is doubled for native display objects: x, y, width, and height. Looks like the issue is only present when dynamic scaling is disabled. All our sample apps have dynamic scaling enabled so this issue hasn’t come up.

This problem doesn’t affect text, images or vector objects.

Did you file a bug report on this? I can file a bug report and sample code if you haven’t.

This should be a simple fix except we need to be careful and not break dynamic scaling and orientation so after we fix it, we need to run though a bunch of test cases.

Thanks for posting this and your test code.

-Tom [import]uid: 7559 topic_id: 29940 reply_id: 120144[/import]

Hi Tom.
Yes, I filed a bug, too.
I also posted a work around here in the meantime:

http://developer.coronalabs.com/code/retina-bug-work-around-native-textfield-creation

Thanks for the response, it really means a lot!

Best,
Chris [import]uid: 13784 topic_id: 29940 reply_id: 120145[/import]

Hi, Tom, when this bug is worked on, it would be great if another native.newTextField related scaling bug is worked on:

http://developer.coronalabs.com/forum/2012/08/14/bug-text-inside-nativenewtextfield-object-does-not-scale-device

It’s filed as Case# 16571.

Thanks!
Naomi [import]uid: 67217 topic_id: 29940 reply_id: 120149[/import]

For reference, on build 881, nativeTextFields on Android do not set font size correct.

If the font is 10, and you set it to 11, it will go to random amount like 18…

[import]uid: 13784 topic_id: 29940 reply_id: 120201[/import]

@marble68, I use native.newTextField objects, so I would want to know if there’s a problem positioning them on device.

As far as I am aware, all of my native.newTextField objects appear & position as expected on iPhone retina and New iPad devices (mirroring exactly how I see them on Corona Simulator – and I viewed every iOS device type available on simulator.)

I run your code on simulator but I haven’t built it to test it on device. Do you mind explaining how it changes on device?

Naomi

Edit: In my case, I use letterbox scaling in config.lua, with width = 320 and height = 480 (although you mentioned scaling isn’t a solution or workaround, I thought I’d mention this anyhow.) [import]uid: 67217 topic_id: 29940 reply_id: 120090[/import]

Naomi - do you use corona scaling? If so, remove that. Simply rename your build.settings.

Use native x y positioning. Of note, this does NOT manifest on the xCode simulator for iPhone or iPad, only iPad Retina (iphone 4)

It doesn’t manifest in Corona Simulator, but will on XCode simulator if you pick a retina display.

I have tested this on the XCode simulator and 5 physical devices.
New iPad (retina)
iPod Touch (retina)
Epic 4G (android 2.3)
Samsung Galaxy Tab (android 2.3)
Transformer TF101 (android 4.0)

It only manifests on the two physical retina devices or in the xcode simulator when I pick retina hardware.

[import]uid: 13784 topic_id: 29940 reply_id: 120091[/import]

I am hoping someone who is on the current ‘release’ can test this and confirm if they see it there, too. [import]uid: 13784 topic_id: 29940 reply_id: 120092[/import]

Correct, turning on scaling introduces all kinds of challenges - especially that I’m over 8 months into this project. [import]uid: 13784 topic_id: 29940 reply_id: 120095[/import]

Scaling is great but there are advantages to NOT using it. [import]uid: 13784 topic_id: 29940 reply_id: 120096[/import]

Retro tested to 840, but exists there, too.

[----------- EDIT -----------]
[I have updated the title to reflect that the bug exists all the way back to 840 (the oldest I’ve tested)] [import]uid: 13784 topic_id: 29940 reply_id: 120079[/import]