i am using this a1 = [[NSMutableArray alloc] init]; now what should be the best way to release a1
right now i am releasing in dealloc()
i am allocation a1 in viewdidload() and displaying 10 images there
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.
A basic example would be this:
For your case, you’d want to release the array once you are finished with it (i.e. at the end of
viewDidLoadis probably a safe bet as long as you truly are finished with it). If you do it this way, you don’t need to create an NSMutableArray object in your .h file, synthesize it and release in dealloc. Instead, you just create a temporary one like I did above and release it when you’re done showing the images from it.