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
3tothe...@comcast.net



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to