@interface ClassA : UITableViewController {
NSString *member;
}
@end
The member is declare like above.
if I use
NSString * astring = [[NSString alloc] initWithString:@"???"];
member = astring;
Will the member retain the astring?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
NO it will not retain it. This is instance varaible (also called iVar). It does not release old object and does not retain the new object (as a typical declared property in setter).
//If property
self.member = aString;// call setter, equivalent to [self setMember:aString], the old value is released and a retain (or copy depending on property declaration) message is sent to aString.If iVar
member = aString//No memory management.