私は、テーブルにセルを入力してそれらを画面上に表示する必要があるプロジェクトに取り組んでいます。私は表を表示しているが、データはセルに表示されている。私はブレークポイントを使ってみましたが、このメソッドが呼び出されることはありません。その直前のメソッド(numberOfRowsInSection)が呼び出されます。助言がありますか?cellForRowAtIndexPathが呼び出されていませんか?
- (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;
}
彼はnumberOfRowsInSectionはそれが返さnumberOfRows/numberOfSectionsあなたは正しかった0 .. – Mario
くぼみ予告ものは設定されているように見える呼び出されたので、ゼロを返します。今はアレイがゼロカウントで戻ってくる理由を理解しなければなりません。 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)セクション{ NSLog(@ "Count =%i"、[appDelegate.residents count]); 戻り値[appDelegate.residents count]; – Roshit
であることをする必要があります..だから、カウントが悪い私..でした.... –