I've been reading that if I have something like this:
@property (nonatomic, assign) UIView *anView;
Then I don't have to care about memory management. I don't have to do [anView release] in the -dealloc method.
Why?
"assign" just tells the compiler: "Hey man, this property does not retain whatever anyone assigns to it". And then you may do
@synchronize anView;
and the compiler magically creates a getter and setter, where the setter may just look like that:
- (UIView*) anView {
return anView;
}
and the Setter may look like:
- (void) setAnView:(UIView*)newAnView {
anView = newAnView;
}
right/wrong? If that was right, the setter claims no ownership of the newAnView variable, since it's not a "retain" property. It just takes it and assigns it to the instance variable. So when considering the ownership policy, there is no need for releasing the anView instance variable in the -dealloc. The object doesn't own it. Ist that correct?