- //Calculate the size necessary for the UILable
- NSString *theText = @"Texting";
- CGSize theStringSize = [theText sizeWithFont:font
- constrainedToSize:theLabel.frame.size
- lineBreakMode:theLabel.lineBreakMode];
-
- //Adjust the size of the UILable
- theLable.frame = CGRectMake(theLable.frame.origin.x,
- theLable.frame.origin.y,
- theStringSize.width, theStringSize.height);
- theLable.text = theText;
复制代码 |
|