Ошибка: - использование ячейки с объявленным идентификатором.не удалось загрузить два вида таблицы в одном представлении контроллера
не удалось загрузить две пользовательские ячейки в одном контроллере.
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
if (tableView == tableView_grantRecordAccess)
{
UITableViewCell *cell = [tableView_grantRecordAccess dequeueReusableCellWithIdentifier:@"EHSRecordAccessGrantCell"];
if (cell == nil) {
// Load the top-level objects from the custom cell XIB.
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"EHSRecordAccessGrantCell" owner:self options:nil];
// Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain).
cell = [topLevelObjects objectAtIndex:0];
}
return cell;
}
else if (tableView == tableView_accessRecordRequest) {
UITableViewCell *cell = [tableView_accessRecordRequest dequeueReusableCellWithIdentifier:@"EHSAccessRecordCell"];
if (cell == nil) {
// Load the top-level objects from the custom cell XIB.
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"EHSAccessRecordCell" owner:self options:nil];
// Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain).
cell = [topLevelObjects objectAtIndex:0];
}
}
return cell;
}
проверить идентификатор ячейки в XIB. –
in else if condition мы получаем ошибку использования ячейки незаявленного идентификатора –
Закрывающий брекет не используется ("}") в состоянии 'else if', когда вы возвращаете ячейку, она не определена. Отступ правильно введите код, вы увидите. Это должно быть после 'return cell; 'вместо ранее. – Larme