I’m having a issue using Corona SDK with iOS7 when dealing with native.newTextField and the “editing” event.
I have the above code, and run it perfectly on Corona Simulator 2013.1198 on Mac and on iOS 6.1 and Android. But when running the same code on iOS 7.0 DP5 on the XCode Simulator or on the Device, the system does not recognize the last typed character.
I did not test it on the last GM build of iOS 7, but will do it soon.
Thanks for your help.
mail.lua
local widget = require( “widget” );
local txtInput = “”
local group = display.newGroup()
local txCustomerListener = function(event)
if event.phase == “editing” then
txtInput = event.text
end
end
local lb = display.newEmbossedText( group, “Some text:”, 0, 0, native.systemFontBold, 24, {255,255,255,255} )
lb:setTextColor( 255 )
lb:setReferencePoint( display.BottomLeftReferencePoint )
lb.x, lb.y = 50, display.contentHeight / 2 - 130
local txCustomer = native.newTextField( 50, display.contentHeight / 2 - 113, display.contentWidth - 80, 47 )
txCustomer:setTextColor( 0, 0, 0 )
txCustomer.inputType = “default”
txCustomer:addEventListener( “userInput”, txCustomerListener )
group:insert(txCustomer)
local buttonPress = function( event )
local alertBox = native.showAlert( “My Alert Box”,
"The input value is: " … txtInput,
{“OK”, “Cancel”} )
end
local button = widget.newButton
{
defaultFile = “btnBlueMedium.png”,
overFile = “btnBlueMediumOver.png”,
label = “Submit”,
fontSize = 16,
labelColor =
{
default = { 255, 255, 255 },
},
onPress = buttonPress,
top = display.contentHeight / 2,
left = display.contentWidth / 2 - 80,
}
group:insert(button)