• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Making an object release itself?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: [NSImageView animator] - will this animate setImage: ?
  • Next by Date: Re: Odd EXEC_BAD_ACCESS after executing URLRequest
  • Previous by thread: iPhone ripple effect
  • Next by thread: Re: Making an object release itself?
  • Index(es):
    • Date
    • Thread