I am trying to get the width of a single line string, so as to center it properly on the screen. I am looking for something like this on iOS/UIKit
(CGSize)sizeWithFont:(UIFont \*)font
Does any similar string API exist in Lua or Corona SDK? [import]uid: 91950 topic_id: 35065 reply_id: 335065[/import]
[lua]local stringWidth = textObject.width[/lua]
or, if you have scaled or rotated your text:
[lua]local stringWidth = textObject.contentWidth[/lua] [import]uid: 93133 topic_id: 35065 reply_id: 139450[/import]
thanks Nick.
I feel like kicking myself
. Its there on the man page for newText() [import]uid: 91950 topic_id: 35065 reply_id: 139451[/import]
[lua]local stringWidth = textObject.width[/lua]
or, if you have scaled or rotated your text:
[lua]local stringWidth = textObject.contentWidth[/lua] [import]uid: 93133 topic_id: 35065 reply_id: 139450[/import]
thanks Nick.
I feel like kicking myself
. Its there on the man page for newText() [import]uid: 91950 topic_id: 35065 reply_id: 139451[/import]