How to add label/text to image in Corona ?

By | August 21, 2011

Hi,

For adding a label/text to an image in Corona, using Lua, use the following code,


local urGroup = display.newGroup()

local urImage = display.newImageRect('sample.png',70,70)
urImage.x = 150
urImage.y = 250

local urText = display.newText( "SampleText", 0, 0, "Helvetica", 22 )
urText:setTextColor( 0, 0, 0, 255 )

-- insert items into group, in the order you want them displayed:
urGroup:insert( urImage )
urGroup:insert( urText )

🙂

Leave a Reply

Your email address will not be published. Required fields are marked *