When I right align there is what appears to be like a 3-5 pixel padding on the right. But when it is left aligned it is perfectly lined up with the content. Any help would be appreciated.
Try using a negative value for tuneWidth to remove the extra space.
Related
If Konva.Text align is set to right or verticalAlign to middle or bottom it's not being positioned well enough and always have some offset from right or/and bottom. Are there any ways to fix that?
I would like to align the start of the text of two UILabels. I aligned the two UILabels (with the yellow and grey background) and used sizeToFit: to shrink the UILabels to the content but the text is not perfectly left aligned. There is a gap on the left. The gap is bigger or smaller depending on the first character. I would like to align the red lines in the following picture. There is even a small gap with the small font in the grey UILabel but it's barely visible.
With the Z character the gap is smaller but still visible by the yellow area left to the Z
A simple UILabel alignment does not help for my specific problem, because the text content is dynamic and not static. So there could be any combination depending on the data I get from the backend. Therefore I was hoping for a UIFont or UILabel attribute that could return the size of the gap based on the current rendering of the text.
I know that there are great UIFont related attributes like baseline, capHeight and ascender one can access to align text but there seems to be no attribute that would return the value of this gap on the left.
If this doesn’t need to be two UILabels, you could have one with attributed text. Then both lines would be subject to the same layout.
I haven't tried the GUI which people have been posting Screen Shots of, however... the behaviour is consistent with the very nature of typography.
The font sizes are completely different, therefore the width of an em is different, subsequently the letter-spacing is also different.
See this: http://www.w3.org/WAI/GL/css2em.htm for more information.
I know this answer doesn't give you what you have asked for, however it should explain why this is happening.
For customisation such as this (if HTML and CSS) I would use a negative / positive margin on the sub text, however seeing as you are using backgrounds use padding (or the equivalent in your GUI).
Use attributed text of UILabel
set indentation as per your requirement
ref screen shot
Select both the labels and add a constraint called align leading edges.
I want to make two buttons that aligns to left edge and right edge, but following VFL failed.
#"H:|[leftToolbar(60)]-[rightToolbar(60)]|"
The result looks like they all pushed to the left, the second right toolbar was not pushed to the right.
What did I miss here?
#"H:|[leftToolbar(60)]-[rightToolbar(60)]|" says this ...
leftToolbar width should be (60)
rightToolbar width should be (60)
space between leftToolbar right edge and rightToolbar left edge should be standard (20, 8, ... depends on situation) (...]-[...)
leftToobar left edge should be aligned with superviews left edge (|[...)
rightToolbar right edge should be aligned with superviews right edge (...]|)
If standard space is 20 for example and your superview width is not 60+20+60=140 I would expect random results.
You can split it in two VFLs ...
#"H:|[leftToolbar(60)]"
#"H:[rightToolbar(60)]|"
... which says 60 for both buttons, one aligned to the left, another aligned to the right and I don't care whats between them and even if they overlap or not in case of small views.
Or do what Praveen recommends, but play with priorities (#...) to say what's more important for you. For example item width, or spacing between them, ...
Try this #"H:|[leftToolbar(==rightToolbar)]-[rightToolbar(==60)]|"
I m trying to align the attributed text of UILabel with multiple lines as below.
The alignment should be like all the days in chars left align and timings right align. How can i do this .Please suggest.
Thanks
I would break the string into 2 and align the day to right and the time to left. Otherwise you need to calculate each letters width (and the spacing between the letter before and/or after.) Fonts are complex as the glyph itself and its spacing to neighbours are different from letter to letter.
I hope there is someone who found an elegant way to do this.
I also had very similar task and here is how I did it.
I achieved this by breaking the line into two pieces.(what should be aligned left and what should be aligned right)
Then on your view create two UILable with the equal widths.
After that display left side in Keys Label and right side in Values label
Do not forget set Lines to 0
Left align your text.
textAlignment = NSTextalignmentLeft
Separate each line with "\n" to force a new line
#"Tuesday 9:20\nWednesday 8:40"
I have used Spline with inverted axes, in that i need categories alignment left side.
"Is committed to advancing the future of technology" at present it is right aligned, now i need left aligned.
Please help me on this.
or example
http://www.highcharts.com/demo/area-inverted/grid
In the above link i need Monday et.. should be left aligned.
Yes, it's possible, but you will need to specify:
chart.marginLeft
xAxis.labels.x
xAxis.labels.align to left
See together: http://jsfiddle.net/fAfC4/
Note that leftMargin and x are fixed values, so it won't resize in a default way, like does by default.