0

データをcoreDataに保存して、テーブルに表示しています。私は3つのエンティティを持っています:

EntitySet <------>> EntityRow <------>> EntityDetails
(多数のリレーションシップへ)

テーブル、セクション、および行のデータを読み取って表示している間、正常に動作します。しかし、問題は、EntityRow のすべてのデータがすべてのセクションに表示されることですが、セクション X に属する行のみを表示したいということです。

ここで何が間違っている可能性がありますか? この問題を解決する方法がわかりません。私の tableView: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] autorelease];  
}  

EntityRows *rows = [_rowsX objectAtIndex:indexPath.row];  

cell.textLabel.text = rows.title;  

return cell;  
}  

または、coreData の私の間違いでしょうか? 間違った関係?

助けてくれてありがとう、brush51

4

1 に答える 1

1

ハム..

確認:

  • (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

複数のセクションがある場合は、indexPath.section と indexPath.row を

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
于 2011-09-22T13:47:50.933 に答える