Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Photo Browser iPhone App Collection Views Customizing a UICollectionViewFlowLayout

thibaut noah
thibaut noah
8,692 Points

minimumInteritemSpacing not working

I don't get it, i have the exact same code (or i have troubles reading) and yet the line of code assigning a value to minimumInteritemSpacing doesn't do anything? minimumLineSpacing is working like a charm btw. 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]);

2 Answers

Hi,

Which device are you simulating when you run your app?

When I run using the iPhone 4s sim, it looks pretty exactly like the video. When I run using the iPhone 6s sim, there are much bigger gaps between the cells.

So looks like it's due to the resolution (?) of the screen on different devices.

Is that what you're seeing?

I expect that to get it having the squares right for all devices, needs to have the 106.0 x 106.0 be dynamically calculated - a problem for another day for me I think.

Hamish

Ravin Kohli
Ravin Kohli
3,367 Points

for iphone 6 you can use 124.0f as your parameters for the cgsizemake method