Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate Size #33

Open
flodev03 opened this issue Mar 26, 2013 · 3 comments
Open

Calculate Size #33

flodev03 opened this issue Mar 26, 2013 · 3 comments

Comments

@flodev03
Copy link

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.

@vanderneut
Copy link

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 :-(

@kdaker
Copy link
Contributor

kdaker commented Mar 27, 2014

I get the height for RTLabel by calling [myRTLabel setNeedsDisplay] after setting the text then getting the height like so myRTLabel.optimumSize.height

@adnanbajwa
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants