RTLabel
RTLabel copied to clipboard
Calculate Size
Hi honcheng,
first of all i want to thank you about this amazing label you give us.
I'm using RTLabel in my new app, everything is cool, great features, nice behavior...
I only have one thing that is making me lose my mind : how to calculate the size of the RTLabel depending on NSString ?
I use a CGConstraint to calculate the height of the label based on the RTLabel's text (NSString) but sometimes it is longer, sometimes shorter... can't have the real size.
How can i do this ?
thanks.
Ps : maybe you should add a donation button using paypal.
FWIW, I am having this problem as well. I need to show multiple RTLabels below each other in a view, but am unable to control the label placements because I cannot get an accurate height reading. At this point it looks like I have no choice but to abandon using RTLabel and instead using regular UILabels without the text formatting :-(
I get the height for RTLabel by calling [myRTLabel setNeedsDisplay]
after setting the text then getting the height like so myRTLabel.optimumSize.height
I had the same issue, found solution after initialization of RTlLabel with frame of height 100.
RTLabel *yourLabel = [[RTLabel alloc] initWithFrame:CGRectMake(0,0,100,100)]; then assign text n get optimize height and update frame of yourLabel.