В вашем источнике данных для вашего UITableView есть метод:
-tableView:objectValueForTableColumn:row:
В этом методе вы можете проверить NSArray или все, что у вас есть, для предоставления данных в вашу таблицу, чтобы увидеть, есть ли какие-либо записи. Если их нет и запрос выполняется для нулевой строки, нулевого столбца, просто верните строку «no data».
Чтобы уточнить синтаксис, предположим, что у вас есть NSArray с именем песни, которую вы хотите напечатать:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//boilerplate cell production
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
//check if we have data to supply, if not set message to "No Songs Available"
//otherwise print the name of the song in each cell
if (indexPath.row == 0 && indexPath.section == 0 && [songs count] == 0)
cell.textLabel.text = @"No Songs Available";
else if (indexPath.row < [songs count])
cell.textLabel.text = [(Song *)[songs objectAtIndex:indexPath.row] songName];
return cell;
}