mercredi 15 juin 2016

I uitableview the (cell = nil) always not call?


in the ui tableview cell, the statement if (cell == nil) is not called.

Because when i initialize the cell outside the if statement, the talbe will have some wrong label in wrong row.

how can I initialize my cell?

The @"tttestttt" NS LOG is not all the time when the table is created.

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *MyIdentifier = @"GroupsCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
    NSLog(@"tttesttttt");
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault  reuseIdentifier:MyIdentifier];
}

}


Aucun commentaire:

Enregistrer un commentaire