Label is genarally we used to display custom static messages to any application. Here we will see how can we display multiline message label to the screen.
Along with single line label, sometimes the label contents become too long which leads to show them in multiline. Corona sdk provides a simple trick to do that using newText function. We just need to assign height and width of the label.
CODE BLOCK :
-- Define multiline message label
local multilineMsgLabel = display.newText( "This is a multiline label message. To make a multiline label we just need to assign height and width of the label.", 15, 100, 300, 400, native.systemFont, 40 )
multilineMsgLabel:setTextColor( 0, 0, 255 )
On above code block nyou can see that I have assign long message the label. Than the nex two parameters(15 and 100) describes the left and top position respectively.
Than nex two parameters ( 300 and 400 ) mentioned width and height of the label which exactly makes the label multiline.
Summary : So now we know how to easily we can make a multiline labels on our crossplatform application using corona sdk and its library.