【发布时间】:2018-01-24 08:37:33
【问题描述】:
这是我在 cellForItemAtIndexPath 中的代码,我想要两个 collectionView 的负载单元。这里第一个加载完美,但第二个加载正确。
} else if (collectionView == _collBanner) {
static NSString *cellIdentifier = @"bannerCell";
NSDictionary *dictBanner = [arrImages objectAtIndex:indexPath.row];
BannerCollectionViewCell *cell = (BannerCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
[collectionView registerNib:[UINib nibWithNibName:@"BannerCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:cellIdentifier];
[cell setupBannerCell:dictBanner];
return cell;
}
return nil;
}
而我的 sizeForItemAtIndexPath 方法是……
} else if (collectionView == _collBanner) {
return CGSizeMake(_collBanner.frame.size.width -5, _collBanner.frame.size.height -2);
} else
return CGSizeMake(0, 0);
}
【问题讨论】:
标签: ios objective-c uicollectionview uicollectionviewcell