• 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: How can I copy/duplicate an existing NSTextField?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I copy/duplicate an existing NSTextField?


  • Subject: Re: How can I copy/duplicate an existing NSTextField?
  • From: Mark Onyschuk <email@hidden>
  • Date: Fri, 24 Nov 2006 19:14:42 -0500

Controls (like NSTextField) each have an associated cell which contains the display attributes of the control. NSCell and its subclasses implement copying, so you can copy the cell instead of the view (which does not support NSCopying).

Alternatively, NSViews support NSCoding, so generally speaking if you have a view or subclass that you need to replicate, one way to do it is to archive it and then unarchive it for however many "copies" you might need.

- Mark

On 24-Nov-06, at 6:54 PM, Tito Ciuro wrote:

Hello,

I have an NSTextField connected to an IBOutlet. This text field contains certain properties, such as font, size, color, and other attributes. I need to replicate this field programatically several times, in order to add it to a view. I thought I could do something like:

NSTextField *myField = [templateField copy];

Unfortunately, this raises an exception. So my question is: how can I replicate a NSTextField retaining its attributes?

Thanks in advance,

-- Tito
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
40rogers.com


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >How can I copy/duplicate an existing NSTextField? (From: Tito Ciuro <email@hidden>)

  • Prev by Date: How can I copy/duplicate an existing NSTextField?
  • Next by Date: NSImage ignoring interpolation: Is this a bug?
  • Previous by thread: How can I copy/duplicate an existing NSTextField?
  • Next by thread: Re: How can I copy/duplicate an existing NSTextField?
  • Index(es):
    • Date
    • Thread