开发者

Where to dealloc local object?

开发者 https://www.devze.com 2023-03-21 09:59 出处:网络
In开发者_高级运维 viewDidLoad I have the following added to the subview: NSArray *pa = [NSArray arrayWithObjects: @\"Test\", nil];

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消