I have a UICollectionView that shows images similar to cover art or iBooks. I would like it to show the name of the audio clip under UIImageView. I have a View Controller with a UICollectionView inside it in my MainWindow.xib. I also created NibCell.xib for the cell itself. In the cell, I have a UIImageView that fills everything except the bottom 30 pixels of the cell. In this area, I add UILabel. I give a UIImageView tag of 100 and a UILabel with a tag of 200, and in my code I put:
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { RSSEntry *entry = [_allEntries objectAtIndex:indexPath.row]; static NSString *cellIdentifier = @"cvCell"; UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath]; UIImageView *titleLabel = (UIImageView *)[cell viewWithTag:100]; UILabel *titleLabel2 = (UILabel *)[cell viewWithTag:200]; NSString *thearticleImage = entry.articleImage; [titleLabel setImageWithURL:[NSURL URLWithString:entry.articleImage] placeholderImage:[UIImage imageNamed:@" icon@2x.png "]]; [titleLabel2 setText:entry.articleTitle]; return cell; }
However, no matter how the cell is configured in NibCell.xib, it causes the UIImageView to fill the entire cell and adds a UILabel on top of it. Any suggestions?
source share