【发布时间】:2011-08-25 07:57:08
【问题描述】:
UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
cell.accessoryView = switchView;
[switchView adTarget:selfaction:@selector(switchChanged:)forControlEvents:UIControlEventValueChanged];
[switchView release];
我在 tableView 中分配了切换视图:cellForRowAtIndexPath:。 我必须在 dealloc 中释放 cell.accessoryView 吗?
这不是比上面更好吗?
cell.accessoryView = [[[UISwitch alloc] initWithFrame:CGRectZero]autorelease];
【问题讨论】:
标签: iphone