2つのエンティティがあります(部門<->>従業員)。
この部門には4人の従業員がいます。この部門のすべての従業員を取得すると、ログウィンドウに次のように表示されます。
CoreData:アノテーション:合計フェッチ実行時間:4行で0.0017秒。
すべてうまくいきます。
ただしUICollectionView
、最初の従業員のみを4回表示します。例えば:
Employee1、Employee1、Employee1、Employee1
それ以外の
Employee1、Employee2、Employee3、Employee4
私は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_はフェッチ後のNSMutableArrayです