Re: creating NSTextField instances
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