分配 - 添加为附件视图 - 发布:是否泄漏? [英] Alloc - add as accessoryView - release: does it leak?

查看:25
本文介绍了分配 - 添加为附件视图 - 发布:是否泄漏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这会泄漏内存吗?此代码在单元格创建块外的 cellForRowAtIndexPath: 中执行(因此每次更新表格单元格时).

Does this leak memory? This code is executed in cellForRowAtIndexPath: outside the cell creation block (so each time the table cell is updated).

MyView *myView = [[MyView alloc] init];
// ... configuration code
cell.accessoryView = myView;
[myView release];

或者换句话说,当一个新对象被分配给它时,UITableViewCell 会释放它的 accessoryView 中的对象吗?

Or in other words, will the UITableViewCell release the object in its accessoryView when a new object gets assigned to it?

谢谢.

推荐答案

是的,单元格会释放附件视图,您在示例中没有泄漏.

Yes, the cell will release the accessory view and you do not have a leak in the example.

这篇关于分配 - 添加为附件视图 - 发布:是否泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆