Just make sure you remember with the memory allocation stuff...using a method with "new", "init", or "copy" in the name means that you're taking ownership of that object. Whenever you take ownership of an object its your code's responsibility to relinquish ownership of it at some point...be that during your dealloc method or at some other point in the code.
For example, say you had a code snippet that looked like this:
Code:
-(id)init {
if (![super init])
return nil;
s = [[NSString alloc] initWithString:@""];
}
-(void)dealloc {
[s release];
[super dealloc];
}
-(void)appendStringOntoStringIvar:(NSString*)aString {
s = [[[s autorelease] stringByAppendingString:aString] retain];
}
Everything here is balanced, and ownership is taken and released as they should be. Each method has a balanced number of retain and release/autorelease calls.
Sorry if I'm harping, but I've been picking up a lot of this stuff pretty quickly over the last couple weeks and its fundamentals like this that I wish I had known when I started...so I try and pass it on to others. 馃槢