label alignment doesn't appear to work correctly.

I have ten labels in a column, all with the exact same bounds except for the y attribute. All have “align” set to left. However, different text shows up with a different left position. I thought I had read there was a potential problem on the simulator, but this occurs on an actual iPhone as well.

Same problem for align = “right”.

Also, same problem if I use label.align = “left”, though I honestly wouldn’t expect that to change things.

Am I missing something?

Sean. [import]uid: 4993 topic_id: 590 reply_id: 300590[/import]

Im too having issues. If I attach a ui label to a group and rotate that group the text alignment shifts while the group is being rotated. Im assuming this is a current bug and will hopefully be fixed shortly (or no landscape mode my my app!) [import]uid: 5354 topic_id: 590 reply_id: 1158[/import]

could you guys provide me with some code to look at

info@anscamobile.com

c
[import]uid: 24 topic_id: 590 reply_id: 1166[/import]

Not a whole lot I can show you, but here’s some code:

-- This implements my high score list.  
local label\_hchaln1 = ui.newLabel{  
 bounds = { 33, 50, 125, 20 },  
 text = "Sean",  
 textColor = { 255, 255, 255, 255 },  
 size = 16,  
 align = "left"  
}  
label\_hchaln1.isVisible = false  
-- much later in code, and after an event..  
 showHighScoresGroup:insert(label\_hchals1)  
 label\_hchaln1.isVisible = true  
 if(scores\_hchal[1] \> 0) then  
 label\_hchaln1.text = names\_hchal[1]  
 else  
 label\_hchaln1.text = " "  
 end  
-- and even though I know it shouldn't be necessary, and it doesn't seem to help  
-- I do:  
 label\_hchaln1.align = "left"  
 showHighScoresGroup.parent:insert(showHighScoresGroup)  

When the above code (plus mode, of course) finishes, the user should see a two column high score list, the names left justified, the scores right justified. What I see, however, is not left (or right) justified. The label contents are centered within the entire label width.

Aligning left, center, or right does make a different, but the labels aren’t pushed all the way left or right when aligned accordingly.

If you want to shoot me an email, I can provide you a screen shot of what it looks like.

Sean.
[import]uid: 4993 topic_id: 590 reply_id: 1176[/import]

email me a screenshot as well.

support@anscamobile.com

carlos [import]uid: 24 topic_id: 590 reply_id: 1177[/import]

This bug comes up in a couple of other threads, but I’m logging it here as bug #127.

The solution is the same in all cases: the ui.label object is a fairly lightweight convenience function that was basically designed to right-align fields in the Compass sample app. People are now using it for more robust purposes, and this needs to be rebuilt at a lower (non-Lua) level so it behaves as expected.

Also, we’ve roadmapped native landscape support, which will simplify landscape coding in general. [import]uid: 3007 topic_id: 590 reply_id: 2003[/import]