Vertically Centering a String within a View
Vertically Centering a String within a View
- Subject: Vertically Centering a String within a View
- From: August Trometer <email@hidden>
- Date: Wed, 4 May 2005 19:03:31 -0500
I have an NSView subclass which I need to display messages in from
time to time. I'm displaying these messages via the drawRect: method.
I'd like to have these messages both centered horizontally and
vertically.
Horizontal centering is easy and done within the string attributes. I
can't seem to find a good way, however, to do the vertical centering.
The string attributes are set to wrap the words, and, depending on
the length of the string, the space needed can change.
It seems kind of silly that I would need to calculate the word-wrap
myself, then back-track to calculate the positioning. Is there an
easier way?
Thanks!
August
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden