In Objective-C, if I have a method in which I select and initialize an object and then return it, where / how to free it?
for example, let's say I have a method in which I create an object:
- (void)aMethod {
UIView *aView = [self createObject];
}
- (UIView *)createObject {
UIView *returnView = [[UIView alloc] initWithFrame:CGRectZero];
return returnView;
}
When can I let this object go? Or am I just auto-advertising?
source
share