Re: basic Obj-C lesson (was runtime error with NSArray no more!)
Re: basic Obj-C lesson (was runtime error with NSArray no more!)
- Subject: Re: basic Obj-C lesson (was runtime error with NSArray no more!)
- From: Mike McCune <email@hidden>
- Date: Fri, 6 Dec 2002 13:51:29 -0500
On Friday, December 6, 2002, at 10:18 AM, Sherm Pendley wrote:
Is that the array you created with arrayWithObjects:? If so, that
method returns an autoreleased object. An autoreleased object normally
only exists for the lifetime of the event (in this case, the
awakeFromNib: event) in which it was created.
<snip>
so are you saying that on my first iteration I should add something
like [[myArray objectAtIndex: i] retain]; and then of course release it
after the second iteration?
that makes a good deal of sense. man, I'm used to C and C++ I don't
know how long it will take to get used to this memory management
scheme. In this specific instance I'm not sure I understand how the
NSButton object is created and destroyed. I mean its in my UI but
you're saying that that the object is only retained as long as the call
is going on? Shouldn't the pointer in my NSArray still point to the
object that exists in the UI? I would love to hear the answer to this,
thanks.
cool runnings,
Mike McCune
OPB Studios
email@hidden
_______________________________________________
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.