1
Я пытаюсь отобразить пользовательский TableView на UIViewController, но я получаю сообщение об ошибке «UITableView DataSource должен возвращать ячейку из Tableview: cellForRowAtIndexPath:»Пользовательские TableViewCells на UIViewController?
я подключен к TableView DataSource и делегат.
Любые предложения по внедрению так или мне нужен UITableViewController?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CustomCell";
CustomCell *cell = (CustomCell *)
[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle]
loadNibNamed:@"CustomCell"
owner:nil options:nil];
for (id currentObjects in topLevelObjects){
if ([currentObjects isKindOfClass:[UITableView class]]){
cell = (CustomCell *) currentObjects;
break;
}
}
}
//---set the text to display for the cell---
cell.cellNameLabel.text = @"This is name";
cell.cellValueLabel.text = @"This is Value";
return cell;
Извините, я не опубликовал весь код. Я отредактирую свой вопрос. –
после редактирования скажите мне –
Пила ваш отредактированный ответ. Все та же проблема. –