• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Vertically Centering a String within a View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Vertically Centering a String within a View
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: [NSConnection release] anxiety
  • Next by Date: NSArrayController and the single NSMutableArray
  • Previous by thread: Re: _NSGetCarbonMenu useage
  • Next by thread: Re: Vertically Centering a String within a View
  • Index(es):
    • Date
    • Thread