the*_*mer 0 iphone uitableview ios ios5
在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;
}
Run Code Online (Sandbox Code Playgroud)
现在我得到一条消息"ARC禁止"和"自动释放不可用"......这是为了解决这个问题的原因是什么?
che*_*ewy 11
只需删除自动释放,ARC就能为您完成工作
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:TableIdentifier];
Run Code Online (Sandbox Code Playgroud)
这该死的魔法
| 归档时间: |
|
| 查看次数: |
4812 次 |
| 最近记录: |