Я пытаюсь добавить источник данных в UITableView. Я попытался следующие, но, к сожалению, не получилось:UITableView и datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 8;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Set the data for this cell:
cell.textLabel.text = [_classCellview objectAtIndex:indexPath.row];
cell.detailTextLabel.text = @"One";
cell.detailTextLabel.text = @"Two";
// set the accessory view:
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
Вызывается ли cellForRowAtIndexPath? – SG1
Что значит «не работает»? – tilo
Я не вижу реализацию для 'tableView: numberOfRowsInSection:', которая требуется для 'UITableViewDataSource'. Не могли бы вы также опубликовать это? – MishieMoo