Skip to content

How to get the label height after ResizeToFitText? #18

@HellCloud

Description

@HellCloud

Hi guys,

here is my code

MTLabel *label3 = [MTLabel labelWithFrame:CGRectMake(20, 240, 250, 1) 
                                  andText:@"This label was resized to fit text inside it"];
[label3 setTextAlignment:MTLabelTextAlignmentCenter];
[label3 setFont:[UIFont systemFontOfSize:20]];
[label3 setResizeToFitText:YES];
NSLog(@"%f", label3.frame.size.height);
[self.view addSubview:label3];

I want to get the label frame size , but the value of NSLog output is always 1.000000
How i get the label frame size after resize ?

Thanks guys.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions