Adjusting Layout in Code | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5429927-beginning-collection-views/lessons/15

@pasanpr, unfortunately the screen does not look like yours =(
Please have a look at it and tell where a bug might be?

@pasanpr Can you please help with this when you get a chance? Thank you - much appreciated! :]

@andreysvx This looks good as far as I can tell. The only difference is in the number of emoji unless I’m mistaken

1 Like

@pasanpr
I think @andreysvx is correct, the formulas aren’t generating the same results as we’re seeing in the video. Despite calling the delegate with a parameter of 6 items, it’s only putting 5 into each row. I’m trying to sort out why it’s not working.

Actually it looks like the issue was in the storyboard. There was a minimum spacing of 20 for cells and lines set in there that was overriding things. I set those to zero and it’s all good. Also, I think for the totalSpacing, shouldn’t the calculation technically be let totalSpacing = interItemSpacing * (numberOfItemsPerRow - 1) since there will be one fewer space than there are items?

2 Likes

@pasanpr Do you have any feedback about this? Thank you - much appreciated! :]

@andreysvx @billmatthews Please check out the updated version of the video course when you get a chance:

I hope it helps!