Say you have a label that’s three digits long, with a fixed with of something big (like 200pts) and you want to know it’s actual width.

Here’s how you do it:


- (void)viewWillAppear:(BOOL)animated
    // get label size
    CGSize size = self.myLabel.frame.size;
    CGFloat width = size.width;
    NSLog(@"original width=%f", width);
    // shrink it down to it's actual size
    CGSize textSize = [self.myLabel.text sizeWithFont:[self.myLabel font]];
    CGFloat strikeWidth = textSize.width;
    NSLog(@"new width=%f", strikeWidth);

Gives the output:

original width=200.000000
new width=35.000000

Links that help