小编Nic*_*ick的帖子

为什么我们使用cellIdentifier?

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath  {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier  ];
    if(cell == nil){
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }
    cell.text = [[views objectAtIndex:indexPath.row] objectForKey:@"title"];
    return cell;
}
Run Code Online (Sandbox Code Playgroud)

为什么我们在这里使用CellIdentifier,为什么它是静态的?

iphone static identifier uitableview ios

3
推荐指数
1
解决办法
2159
查看次数

标签 统计

identifier ×1

ios ×1

iphone ×1

static ×1

uitableview ×1