Re: Centering text drawn to screen
Re: Centering text drawn to screen
- Subject: Re: Centering text drawn to screen
- From: email@hidden
- Date: Thu, 13 Jun 2002 22:29:27 +0200
On jeudi, juin 13, 2002, at 09:54 , Ryan McPherson wrote:
Hello,
I am writing a screensaver that flashes text on the screen using
NSString's
drawInRect:withAttributes: method. I have been successful so far, but
the
text is drawn left-adjusted to the rectangle I'm drawing in and I want
it to
be centered. I couldn't find an attribute that handles this in the
documentation.
Any suggestions?
I would suggest two things:
1) compute your String bounding rect using the APIs:
- (NSSize)sizeWithAttributes:(NSDictionary *)attributes;
2) Use the ScreenSaver API
SSCenteredRectInRect
You can easily get the frameRect of the Screen.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.