Re: Beginner memory management question
Re: Beginner memory management question
- Subject: Re: Beginner memory management question
- From: Luke Hiesterman <email@hidden>
- Date: Wed, 03 Dec 2008 21:27:51 -0800
What you should do is declare newName as a property and then do
self.newName = [stockName stringValue];
The synthesized property will take care of retaining and releasing for
you.
Luke
Sent from my iPhone.
On Dec 3, 2008, at 2:13 AM, Jacob Rhoden <email@hidden> wrote:
I am not sure how one would go about working this, Im writing my
first "test" os/x applications and I am thinking this is probably
not right. Am I doing the retain in the correct place? I tried
reading the documentation on NSTextField but it didnt give me a clue
about if I needed to "retain". (Infact stringValue is not even
mentioned in the NSTextField documentation).
@interface StockListController : NSObject {
IBOutlet NSTextField* stockName;
NSString *newName;
}
-(IBAction) addStockItem:(id)sender;
@end
@implementation StockListController
-(IBAction) addStockItem:(id)sender {
if(newName == nil) [newName release];
newName = [stockName stringValue];
[newName retain];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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