开发者

Where to dealloc local object?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜