Is there a way to auto size a UILabel? given size 40 x 40 the text font size would adjust based on the number of characters.
A:
uhm, did you check out the UILabel API http://developer.apple.com/iphone/library/documentation/uikit/reference/UILabel_Class/Reference/UILabel.html there's a neat property called adjustsFontSizeToFitWidth
lwe
2010-07-14 07:55:15
sorry im new to obj c
Yolanda
2010-07-14 08:12:20
no worries :) sorry, that I didn't provide any sample code. Besides the Apple Docs are very valuable and useful.
lwe
2010-07-14 08:56:59
A:
You can use the adjustFontSizeToFitWidth
property. So something like this.
UILabel *myLabel = [[UILabel alloc] init];
[myLabel setAdjustFontSizeToFitWidth:YES];
In Interface Builder there is a check box on the Label Attributes screen to allow you to adjust the font size to fit the label as well.
Jergason
2010-07-14 07:56:29