2013-06-02 16 views
5

Mam dwie niestandardowe podklasy UITableViewCell, które Xcode nie lubi. Próbuję zadzwonić registerClass: forReuseIdentifier: metodę tak:Nie można zarejestrować niestandardowych podklas 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]; 

A ja dostaję błąd, „Nieoczekiwana nazwa interfejsu ... zamiast oczekiwać ekspresji.” błąd. Jakieś pomysły?

Odpowiedz

8

Musisz wysłać Class do registerClass:forCellReuseIdentifier: więc trzeba to zrobić:

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

Powodzenia!

1

Nieważne, wymyśliłem to. Po prostu musiałem zrobić [klasę ButtonCell].

+0

To wszystko! Nie widziałem tego, dopóki nie opublikowałem odpowiedzi ... – Daniel

Powiązane problemy