0

我还是编码新手,所以请原谅我之前提出的这个问题,但我查看了这些问题,我使用 appcoda 的教程作为我的参考指南,但我仍然坚持没有让搜索栏显示名称。谁能告诉我我在代码中哪里出错了?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = (UITableViewCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];



    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    // Display friends in the table cell


    if (tableView == self.searchDisplayController.searchResultsTableView) {
        self.friends = [searchResults objectAtIndex:indexPath.row];
    }

    else {

        PFUser *user = [self.friends objectAtIndex:indexPath.row];


    }

   PFUser *user = [self.friends objectAtIndex:indexPath.row];
   cell.textLabel.text = user.username;

    return cell;

}
4

0 回答 0