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
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.
精彩评论