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.
Not a whole lot I can show you, but here's some code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | -- 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.
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.
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!)