2013-06-02 18 views
5

Ho due sottoclassi personalizzate di UITableViewCell a cui Xcode non piace. Sto cercando di chiamare il registerClass: forReuseIdentifier: metodo in questo modo:Impossibile registrare sottoclassi personalizzate di UITableViewCell

static NSString* gameCellIdentifier = @"GameCell"; 
static NSString* buttonCellIdentifier = @"ButtonCell"; 
// Register the classes for use. 
[self.tableView registerClass:ButtonCell forCellReuseIdentifier:buttonCellIdentifier]; 
[self.tableView registerClass:GameCell forCellReuseIdentifier:gameCellIdentifier]; 

e sto ottenendo l'errore, "il nome di interfaccia imprevisto ... espressione previsto, invece." errore. Qualche idea?

risposta

8

È necessario inviare un Class-registerClass:forCellReuseIdentifier: quindi è necessario fare questo:

[self.tableView registerClass:[ButtonCell class] forCellReuseIdentifier:buttonCellIdentifier]; 
[self.tableView registerClass:[GameCell class] forCellReuseIdentifier:gameCellIdentifier]; 

Buona fortuna!

1

Non importa, l'ho capito. Ho solo bisogno di fare [classe ButtonCell] invece.

+0

Questo è tutto! Non l'ho visto fino a quando non ho postato la mia risposta ... – Daniel

Problemi correlati