Log*_*ire 5 objective-c uitableview ios
我有两个Xcode不喜欢的UITableViewCell自定义子类.我试图调用registerClass:forReuseIdentifier:方法如下:
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];
Run Code Online (Sandbox Code Playgroud)
我收到错误,"意外的接口名称......预期表达式." 错误.有任何想法吗?
你需要发送一个Class,registerClass:forCellReuseIdentifier:所以你需要这样做:
[self.tableView registerClass:[ButtonCell class] forCellReuseIdentifier:buttonCellIdentifier];
[self.tableView registerClass:[GameCell class] forCellReuseIdentifier:gameCellIdentifier];
Run Code Online (Sandbox Code Playgroud)
祝好运 !