Here's how I do it for a UIButton which is centered in the view/window
and has some padding added around the text.
You'll most likely have to set a maximum size for your label width as
well and change the font size to suit your needs.
#import
NSString* buttonText;
CGSize fontSize = [button
If you look in the NSString (UIStringDrawing) documentation, you'll
see that NSString has a -sizeWithFont: method that returns a CGSize,
which will be the bounding box for that string when its drawn with the
passed in UIFont. You can then use that size as part of the CGRect
for constructin
Hi
I am new to iPhone application development and please help me on this.
I need to add the contents in a text field to a UILabel. But I can't guess
how long the string in the text field be. There fore, can I make a UILabel
from the text ( I mean to fit the text to UILabel size). I have searched bu