开发者

Releasing dynamically added UILabel

I am adding a no. of UILable dynamically to my view like thi开发者_如何转开发s

UILabel *test = [[UILabel alloc] initWithFrame:CGRectMake(x, y, 50, 50)];  
[self.view addSubview:tick];

Is it necessary to release these UILabel from memory in viewDidUnLoad and dealloc, if yes how i will release them? how i will get their reference?


Yes.

Since self.view already -retained the label in -addSubview:, you can -release it immediately.

UILabel *test = [[UILabel alloc] initWithFrame:CGRectMake(x, y, 50, 50)];  
[self.view addSubview:test];
[test release]; // <--
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜