我有一个继承自UIViewController的类可以通过UICollectionView的出口调用它'controller'。 从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;
}
一切正常初始化,但图像不显示,我不知道这是为什么。
有人可以帮助我吗?
你设置了UICollectionViewFlowLayout吗? – 2013-04-05 05:13:14