Object leak using "retain"
Posted
by
Abhinav
on Stack Overflow
See other posts from Stack Overflow
or by Abhinav
Published on 2011-02-23T23:19:10Z
Indexed on
2011/02/23
23:25 UTC
Read the original article
Hit count: 234
I have a property defined with retain attribute which I am synthesizing:
@property (nonatomic, retain) UISwitch *mySwitch;
And inside my loadView I am doing this:
self.mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 40, 20)];
And finally inside my dealloc I am doing this:
self.mySwitch = nil;
Am I leaking this object (mySwitch) as I have used one alloc? Should I autorelease it while assigning it frame?
Please suggest.
© Stack Overflow or respective owner