Suppose I have a view controller like this:
@interface ControllerA : viewcontroller{
NSString * __strong a;
}
@end
and in viewDidLoad function I set
a = [[NSSString alloc] init];
And in another ControllerB,
{
ControllerA * controllerA = [[ControllerA alloc] init];
}
Will controllerA’s member be released?
Yes, the string pointed to by
awill be released whencontrollerAis deallocated. You don’t need to set it tonilyourself.Transitioning to ARC Release Notes is currently the place to look for more information about working with ARC. One important point that it makes is that you may still need a custom
-deallocif your class needs to do anything other than releasing instance variables when it’s instances are deallocated.