Making an object release itself?
Making an object release itself?
- Subject: Making an object release itself?
- From: Jacob Rhoden <email@hidden>
- Date: Wed, 31 Dec 2008 14:28:44 +1100
Im still learning cocoa, so I have a question about if this is a good
idea or a crazy noob mistake. Given the following code can I alter it so
that postreader auto releases itself?
-(IBAction) fetchThreads:(id) sender {
[progress startAnimation:nil];
PostReader* reader = [[PostReader alloc] init];
[reader loadLatestPosts: self];
}
// Callback message
-(void) postsRead {
[progress stopAnimation:nil];
}
Does it make sense that I could clean up things to work more like this:
-(IBAction) fetchThreads:(id) sender {
[progress startAnimation:nil];
[PostReader loadLatestPosts: self];
}
-(void) postsRead {
[progress stopAnimation:nil];
}
I'm thinking PostReader class could have a static function that
initialises a new PostReader object, tells it to start the work, and
then do a [self release] after it has called the callback function
'postsRead';
Thanks!
_______________________________________________
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