gpt4 book ai didi

iphone - ios5 上的自动释放替代方案

转载 作者:行者123 更新时间:2023-11-28 17:58:22 24 4
gpt4 key购买 nike

在 ios5 中,autorelease 的替代方案是什么?以前, TableView 的以下方法可以工作:

-(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 会为您完成工作

cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault 
reuseIdentifier:TableIdentifier];

这该死的魔法

关于iphone - ios5 上的自动释放替代方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7769880/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com