This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In the init function | |
UIView *v = [[UIView alloc] init]; | |
[self addSubview:v]; | |
_someVar = v | |
[v release]; | |
// In the dealloc function | |
[_someVar release]; | |
_someVar = nil; |
Notice that _someVar is released twice. It's super confusing.
Next time, just use @property.
And, when I want to release it, just set the property to nil.
You cannot really go wrong with @property...