2012-04-25 22 views
0

私は、テーブルにセルを入力してそれらを画面上に表示する必要があるプロジェクトに取り組んでいます。私は表を表示しているが、データはセルに表示されている。私はブレークポイントを使ってみましたが、このメソッドが呼び出されることはありません。その直前のメソッド(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; 
    } 

答えて

0

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

+0

彼はnumberOfRowsInSectionはそれが返さnumberOfRows/numberOfSectionsあなたは正しかった0 .. – Mario

+0

くぼみ予告ものは設定されているように見える呼び出されたので、ゼロを返します。今はアレイがゼロカウントで戻ってくる理由を理解しなければなりません。 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)セクション{ NSLog(@ "Count =%i"、[appDelegate.residents count]); 戻り値[appDelegate.residents count]; – Roshit

+0

であることをする必要があります..だから、カウントが悪い私..でした.... –

0

ええ、numberOfRowsInSectionはおそらく0を返します。それを表示し、データソースをどこに配置しますか。

関連する問題