In Objective-C, if I have a method in which I allocate and initialize an object, then return it, where/how do I release it?
for example, let's say I have a method where I create an object:
- (void)aMethod {
UIView *aView = [self createObject];
}
- (UIView *)createObject {
UIView *returnView = [[UIView alloc] initWithFrame:CGRectZero];
return returnView;
}
When do I release this object? Or would I just autorelease it?