Question

i am saving Data in coreData to show it in a Table. I have 3 Entitys:

EntitySet <------>> EntityRow <------>> EntityDetails
(To Many Relationships)

While reading and showing the Data in the Table, Sections and Rows, it works fine. But the problem is, ALL Data from EntityRow is displayed in ALL Sections, but i want to display ONLY the rows which belongs to the Section X.

What can be wrong here? I dont know how to solve this problem. In my tableView:cellForRowAtIndexPath: method it looks like this:

- (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;  
}  

Or may can be my mistake in coreData? Wrong relationship?

Thanks for any help, brush51

Was it helpful?

Solution

hum..

verify:

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

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

if you have more than one section, you must use indexPath.section as well indexPath.row in your

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top