kpo*_*wer 2 iphone objective-c deque uitableview
为什么这段代码工作正常:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.textLabel.text = [NSString stringWithFormat:@"cell%i%i", indexPath.section, indexPath.row];
}
return cell;
}
Run Code Online (Sandbox Code Playgroud)
据我所知,单元标识符,只有当我移出cell.textLabel.text = ...if语句时,此代码才能正常工作.换句话说,为什么标签有正确的文本?
| 归档时间: |
|
| 查看次数: |
8796 次 |
| 最近记录: |