J'ai fait une faute de frappe lors de la création d'un UITableViewCell
avec ce code:Pourquoi ce code TableView fonctionne-t-il?
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [self.tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSLog(@"Creating cell");
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewStylePlain
reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = @"Hello";
return cell;
}
La faute de frappe est à l'utilisation UITableViewStylePlain
au lieu de UITableViewCellStyleDefault
. Le code a bien fonctionné, créant de nouvelles cellules. Pourquoi?
Bah, tu m'as battu de 13 secondes! ;) –
Aha! Merci kubi. –
@Dave –
kubi