In viewDidLoad I have the following added to the subview:
NSArray *pa = [NSArray arrayWithObjects: @"Test", nil];
UISegmentedControl *gobtn = [[UISegmentedControl alloc] initWithItems:go];
Where would I dealloc this local object?
Thanks
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.
You can release it (don’t dealloc directly!) after you use it somewhere else, such as
[myView addSubview:gobtn]. Read the Memory Management programming guide for more information. Furthermore, if you’re making a new app for iOS 5 you should consider using ARC, with which the compiler will do this for you.