• 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
Re: Vertical Alignment in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vertical Alignment in NSTextView


  • Subject: Re: Vertical Alignment in NSTextView
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 5 Jan 2004 12:38:10 -0800

On Dec 29, 2003, at 12:22 PM, David McGavern wrote:

I basically want to find a way to align text vertically, for example in the center of the NSTextView. Here's an ASCII art representation :-) :

There isn't a direct vertical centering option, but are a number of subtly different things you can do. For example, you can move and size the text view itself so that the text is centered in a certain region; or you can move the container within the text view, by calling setTextContainerInset:; or you can move text around vertically inside the container by changing the various NSParagraphStyle options for line and paragraph spacing. All of this assumes that you can determine the height of the text you wish to center, which you can by interrogating the layout manager. This won't by itself keep the text centered vertically if the user edits it, so there would be extra work involved if you needed that.

Douglas Davidson
_______________________________________________
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.

  • Prev by Date: Custom background drawing in NSScrollView : Was there ever an answer to this?
  • Next by Date: New to cocoa/database
  • Previous by thread: Custom background drawing in NSScrollView : Was there ever an answer to this?
  • Next by thread: New to cocoa/database
  • Index(es):
    • Date
    • Thread