0

UIViewController から継承するクラスがあり、UICollectionView へのアウトレットを持つ「コントローラー」と呼ぶことができます。UICollectionCellから継承されたクラスはそれを「A」と呼び、UIImageからの別のクラスはそれを「B」と呼び、AにはBのアウトレットがあります

「コントローラー」に次のコードを書きました。

- (UICollectionViewCell *)collectionView:(UICollectionView *)p_collectionView    cellForItemAtIndexPath:(NSIndexPath *)p_indexPath
{
    UICollectionViewCell* cell = [self getUICollectionViewCellFromCollectionView:p_collectionView AtIndexPath:p_indexPath];
    if([cell isKindOfClass:[ImageCollectionViewCell class]] == YES)
    {
        //draw the image inside the view
        ImageCollectionViewCell* imageCell = (ImageCollectionViewCell*)cell;
        NSString* imageUrl = self.objectToShow.imagesURL[p_indexPath.item];
        UIImage* currentImage = [[UIImage alloc] initWithContentsOfFile:imageUrl];
        imageCell.imageView.image = currentImage;
    }

    return cell;
}

すべてが正しく初期化されていますが、画像が表示されません。その理由はわかりません。

4

1 に答える 1