Re: Vertical Alignment in NSTextView
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.