String attributes in the iPhone SDK
String attributes in the iPhone SDK
- Subject: String attributes in the iPhone SDK
- From: Charlie Dickman <email@hidden>
- Date: Thu, 10 Dec 2009 18:44:40 -0500
I use the following code to determine the height and width of a string in the Snow Leopard version of an app
NSMutableDictionary *textAttributes = [[[NSMutableDictionary alloc] init] autorelease];
[textAttributes setObject: [NSFont fontWithName: @"Garamond Bold" size: 24]
forKey: NSFontAttributeName];
[textAttributes setObject: [NSColor blackColor]
forKey: NSForegroundColorAttributeName];
NSString *text = [NSString stringWithFormat: @"%d", h];
NSSize textSize = [faceText sizeWithAttributes: faceTextAttributes];
x -= faceTextSize.width / 2.;
y -= faceTextSize.height / 2.;
I'm tearing my hair out trying to figure out how to accomplish the same thing in the iPhone SDK. Can anybody help me?
Charlie Dickman
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden