【发布时间】:2011-10-14 15:25:32
【问题描述】:
ios5 中自动释放的替代方法是什么?以前可以使用以下表格视图方法:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
static NSString *TableIdentifier = @"TableIndentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:TableIdentifier]autorelease];
}
cell.textLabel.text = [arrAccounts objectAtIndex:row];
return cell;
}
现在我怎么会收到“ARC 禁止”和“自动释放不可用”的消息...解决这个问题的方法是什么?
【问题讨论】:
-
如果我错了,请纠正我,但我认为 ARC 是编译器功能,而不是 iOS 5 功能。所以你应该能够在以前的 iOS 版本上运行 ARC 编译的应用程序。并且如果你不想使用ARC,你可以将其关闭并继续使用retain release。
-
@Stefan 这并不完全正确。操作系统也必须支持 ARC。也就是说,iOS4 之前的任何东西都没有 ARC 支持。
标签: iphone ios uitableview ios5