iphone memory management: alloc and retain properties.
- by Jonathan
According to the docs, you do one release per alloc or retain (etc)
However what about when using retain propertys?
eg:
HEADER
@property(retain)UIView *someView;
IMPLEMENTATION
/*in some method*/
UIView *tempView = [[UIView alloc] init]; //<<<<<ALLOC - retain count = +1
[tempView setBackgroundColor:[UIColor redColor]];
self.someView = tempView; ///<<<<<RETAIN - retain count = +2
[tempView release]; ///should I do this?
or a different version of the IMPLEMENTATION
self.someView = [[UIView alloc] init]; //<<<<<ALLOC & RETAIN - retain count = +2
//now what??? [self.someView release]; ????
EDIT: I didn't make it clear, but I meant what to do in both circumstances, not just the first.