Type Function Object TextField Library native.* Return value none Revision Release 2024.3703 Keywords resizeFontToFitHeight, native text input See also object:resizeHeightToFitFont() native.newTextField()
Changes the font size to “best fit” the current height of the text field. This will automatically occur when you first create a text field via the native.newTextField() function.
object:resizeFontToFitHeight()
-- Create the text field -- When a text field is created, it will auto-size its font to best fit the field height local textField = native.newTextField( 160, 240, 280, 40 ) textField.text = "Hello World" -- Change the height of the text field textField.height = 60 -- Resize the font to best fit the text field's new height textField:resizeFontToFitHeight()