- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 5; // put your array count
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell;
cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"GIVEYOURCELL_IDENTITIFER" forIndexPath:indexPath];// same identifier storyboard cell
UIImageView *thumbail = (UIImageView*) [cell viewWithTag:YOURCELLIMAGETAG]; // give tag here that you put in cell with imageview
thumbail.image = [UIImage imageNamed:@"ImageName"];// give your image here
return cell;
}
主なポイントは、あなたのViewControllerにストーリーボードからも、あなたの.hファイルにUICollectionViewDataSource, UICollectionViewDelegate
委任を与えます。
データソースとデリゲートを設定しましたか? – KKRocks
ここにコードスニペットを挿入できますか? – KKRocks
いくつかのコードを共有できますか? –