There are two objects ( Department ↔> Employee ).
This department has 4 employees. When I pick up all the employees in this department, my journal window shows:
CoreData: annotation: total sampling time: 0.0017s for 4 rows.
things are good.
But it UICollectionViewdisplays only the first employee 4 times. For instance:
Employee1, Employee1, Employee1, Employee1
instead
Employee1, Employee2, Employee3, Employee4
I have some error in cellForItemAtIndexPath :
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cellRecipe";
collectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
Employee *emp = [array_ objectAtIndex:indexPath.item];
cell.name.text = emp.name;
cell.image.image = emp.thumbImg;
return cell;
}
array _ is NSMutableArray after retrieval
source
share