2011-09-22 88 views
0

我正在將數據保存在coreData中以將其顯示在表中。 我有3個實體:Tableview,Sections,Rows和coreData - 行顯示多個(重複)

EntitySet的< ------ >> EntityRow < ------ >> EntityDetails
(許多關係)

在讀取和顯示數據在Table,Sections和Rows中,它工作正常。 但問題是,從EntityRow所有數據都顯示在所有部分,但我想顯示屬於第十節

什麼可能是錯在這裏只行?我不知道如何解決這個問題。 在我的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

回答

1

哼哼..

驗證:

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

,如果你有一個以上的部分,你必須在你的

  • (UITableViewCell的*)的tableView使用indexPath.section以及indexPath.row:(UITableView的*)的tableView的cellForRowAtIndexPath:(NSIndexPath * )indexPath {