Our app only support portrait
and we are manually rotating some objects, but we are stock with this native.newTextField
-- setupTextField
function setupTextField()
local txNameBG = display.newImageRect( "images/login/login-input-bg.png", 225, 30 )
txNameBG.x = _gameCenter.x
txNameBG.y = _gameCenter.y
sceneGroup:insert(txNameBG)
_events.fixRotate(txNameBG)
if (txName == nil) then
txName = native.newTextField( _gameCenter.x, _gameCenter.y, 225, 30 )
txName.hasBackground = false
txName.inputType = "default"
txName.placeholder = "INSERT NAME"
txName.align = "center"
txName.font = native.newFont( native.systemFont, 15 )
txName:setTextColor( 163, 25, 12 )
txName:addEventListener( "userInput", _events.textListener )
sceneGroup:insert(txName)
-- _events.fixRotate(txName)
end
end
Here is the function the we are using for rotating objects (only those native.*) are not responding.
eventClass.fixRotate = function ( obj )
obj:rotate(90)
obj.isFixedRotation = true
-- obj.angularVelocity = 0
end
This is the correct layout, but the text inside the
native.newTextField
was cut,
This is what happen after rotating(
landscapeRight
)
How do I fix this?
Okay. I found a solution:
settings =
{
...
orientation =
{
// I changed
// supported = { "portrait" }, to
//
supported = { "portrait", "landscapeRight", "landscapeLeft", "portraitUpsideDown"}
}
...
}
Also, I found out that the text that was cut only occurs in Corona Simulator
, but in real device (iP6plus in my case) it is looking pretty well. So as my personal advice, always test your app on a real device.