I searched about this question but can’t found any suitable answer:
I had been working on java for a long time now i want to learn Objective-C
Here is the scenario:
I have an Objective C class which Extends NSObject class that class contains saveral fields of NSString type and CustomObject type i created there property with @property(nonatomic,retain) NSString or MyObject.
After creating object of my custom class i put it in NSArray as [myArray addObject:myObject]
now what i want to ask if i release myArray do i have to release objects inside that array and fields inside that object and some fields are too CustomObject of another class;
When you deallocate an NSArray a release message is sent to every object in the array. If the only reference to your object is in the array, then your object will call its dealloc method, which is in charge of releasing all of its properties.