Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


tom tom
tom tom
1,082 Points

Trying to build Photo Browser iPhone App using ViewController rather than UICollectionViewController

I am trying to learn by having to Build a Photo Browser iPhone App using ViewController rather than UICollectionViewController. If I wanted to have different cell size in the layout how do I go about doing it. Do I implement the following method:

  • (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath

Currently THPhotoViewController.m has set the layout.itemSize = CGSizeMake(106.0, 106.0) at init method like so:

  • (instancetype)init { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; //layout.itemSize = CGSizeMake(106.0, 106.0); layout.minimumInteritemSpacing = 1.0; layout.minimumLineSpacing = 1.0;

    return (self = [super initWithCollectionViewLayout:layout]); }

Secondly, how do I use dequeueCellReuse when you have two different cell sizes.

Any idea suggestions. Thanks.