Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: basic Obj-C lesson (was runtime error with NSArray no more!)



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.

References: 
 >Re: runtime error with NSArray no more! (From: Sherm Pendley <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.