objective c - Objects deallocation question -
i have code:
@interface photolistviewcontroller : uiviewcontroller { iboutlet uiimageview* firstpiccontainer; iboutlet uiimageview* secondpiccontainer; uiimage* pic_one; uiimage* pic_two; iboutlet uilabel* firstpiclabel; iboutlet uilabel* secondpiclabel; nsstring* firstpicname; nsstring* secondpicname; iboutlet uilabel* authorlabela; iboutlet uilabel* authorlabelb; nsstring* authorname; } @property (retain) uiimage* pic_one; @property (retain) uiimage* pic_two; @property (copy) nsstring* firstpicname; @property (copy) nsstring* secondpicname; @property (copy) nsstring* authorname; @end the question is: should release whole pack of objects or those, properties i've declared? example: firstpicname nsstring , retained, when set, container uilabel* firstpiclabel, assigned this:
firstpiclabel.text = firstpicname; in -viewdidload. label object not retained itself, property does. same thing other objects, properties retained, others container. owner of these containers theirs view, should responsible release, i'm confused here, want clarify point. thanks.
short answer: property declare retain (or copy), should set value nil in dealloc method. properties declared on other objects , fields not retain not need worry about.
Comments
Post a Comment