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

Re: creating NSTextField instances


  • Subject: Re: creating NSTextField instances
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Thu, 21 Oct 2004 19:34:09 +0200

At 20:34 Uhr -0400 19.10.2004, Clark Cox wrote:
(Also, BTW, you're retaining that text field too many times. When you
create it via -alloc, it is already implicitly retained once, and you
are retaining it a second time)

In fact, he'll probably even want to release the view. I usually do:

myView = [[[NSView alloc] initWithFrame: box] autorelease];
// set up myView some more.
[[myWindow contentView] addSubview: myView];

Since when you add a view to a superview, it will automatically retain the view. if you want to remove the view from its superview and later re-insert, of course, you may want to not autorelease it, of course. But in that case you'll still have to release the view since you alloc'ed it.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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
References: 
 >creating NSTextField instances (From: Aaron Fothergill <email@hidden>)
 >Re: creating NSTextField instances (From: Clark Cox <email@hidden>)

  • Prev by Date: NSLayoutManager Problem
  • Next by Date: RE: Re: Subclassing NSTableView[Solved]
  • Previous by thread: Re: creating NSTextField instances
  • Next by thread: application:openFile: usage
  • Index(es):
    • Date
    • Thread