• 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: NSTextView vs NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView vs NSTextField


  • Subject: Re: NSTextView vs NSTextField
  • From: Ron Fleckner <email@hidden>
  • Date: Fri, 12 Nov 2010 14:51:20 +1100

On 12/11/2010, at 12:45 AM, Eric Gorr wrote:

> It seems to me that NSTextView can do everything that NSTextField can and more. For example, on a NSTextView, one can use the method setHorizontallyResizable: and then call sizeToFit to get it to resize itself vertically instead of horizontally.
>
> Is this correct?
>
> If so and if I am programmatically creating one of these controls, is there any reason why I would want to use a NSTextField?
> (I know that IB uses a NSTextField for Labels, for example...is this just a historical artifact?)
>
> If not, what are the key differences between them that would cause me to want to use a NSTextField? Would it basically come down to whether or not I need more then a single line of text or not...NSTextField seems to be optimized for single lines of text, but one can still get the same behavior out of a NSTextView with a bit more work.
>
> Now, I know that NSTextFieldCell is commonly used as a superclass for one's own cell based stuff, but I would consider that as separate from the issue of NSTextField vs NSTextView.
>
> Thank you.
>

One important difference the others forgot to mention is that NSTextField's are a subclass of NSControl.  So they can send messages to, for instance, IBAction methods in your code whenever editing ends via a Tab or Enter key.

Ron


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSTextView & Vertical resizing using sizeToFit (From: Eric Gorr <email@hidden>)
 >NSTextView vs NSTextField (From: Eric Gorr <email@hidden>)

  • Prev by Date: Re: Detecting reading a key in KVC
  • Next by Date: Re: Detecting reading a key in KVC
  • Previous by thread: Re: NSTextView vs NSTextField
  • Next by thread: Re: Cocoa-dev Digest, Vol 7, Issue 1044
  • Index(es):
    • Date
    • Thread