0

テーブルにセルを入力して画面に表示する必要があるプロジェクトに取り組んでいます。表示するテーブルがありますが、データがセルに表示されています。ブレークポイントを使用してみましたが、このメソッドが呼び出されないことがわかりました。その直前のメソッド(numberOfRowsInSection)が呼び出されます。助言がありますか?

- (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];
        }
        Resident *aResident = (Resident *)[appDelegate.residents objectAtIndex:indexPath.row];   
        cell.textLabel.text = aResident.name;
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

        return cell;
    }
4

2 に答える 2

0

TableViewのデリゲートとデータソースを設定しましたか?

于 2012-04-25T20:25:26.793 に答える
0

ええ、numberOfRowsInSectionはおそらく0を返します。それとデータソースを入力する場所を表示します。

于 2012-04-25T20:26:22.237 に答える