Re: width of NSString in pixels
Re: width of NSString in pixels
- Subject: Re: width of NSString in pixels
- From: Raphael Sebbe <email@hidden>
- Date: Tue, 27 Nov 2001 15:04:39 +0100
Here is a code fragment that does what you want (I believe you should
have a look at NSString additions in AppKit doc) :
NSString *drawString = [NSString stringWithFormat:@"Time: %g\nValue:
%g", _spTime, _val];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSColor grayColor], NSForegroundColorAttributeName,nil]; // you
can add the font... here
NSSize size = [drawString sizeWithAttributes:attributes];
Raphael
On Tuesday, November 27, 2001, at 01:27 PM, Robert Miller wrote:
Hello,
Can someone tell me how to determine the width of an NSString in
pixels using Cocoa? I can only find this functionality in the Carbon API
using the Appearance Mgr. ? Am I missing something ?
Thanks in advance,
Regards,
Bob M.
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev