Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot change custom UICollectionViewCell in Storyboard

I have a UICollectionView with custom UICollectionViewCells. I used Interface Builder (via XCode 8) to size the collection view and cells when first making it.

Now, I'm trying to adjust the size of the cells and I'm unable to do so in Interface Builder (using XCode 9). I cannot adjust the width or height of the cells on either the collection view itself or on the custom cell. The up/down arrows don't do anything and neither does typing in a value. It just stays set at 145.

I saw some answers about not being able to do this with a UICollectionViewController via Interface Builder, only a UICollectionView, but it is a collection view and not UICollectionViewController.

I'm sure there's some new setting/config in XCode 9 that I'm missing, but I can't figure out why I can't adjust the custom value.

like image 444
rpmartz Avatar asked Nov 19 '17 04:11

rpmartz


3 Answers

I ran into the same problem.

Turned out that the item size was defined by the contained flow layout. So editing the item size in the flow layout, and the parent collection view had its item size changed accordingly.

like image 94
Jonny Avatar answered Sep 30 '22 03:09

Jonny


I tried Jonny's answer, but I use a custom FlowLayout and couldn't edit it's cell size either. I had to manually edit the size of the collection view, the cell and the layout in the storyboard source code (right-click on the storyboard in project view and select "open as / source code").

Now the size is correct but still not editable from the UI ¯_(ツ)_/¯

like image 42
Dorian Roy Avatar answered Sep 30 '22 05:09

Dorian Roy


Same problem, width would not change. But I changed the height to something different and it then let me edit the width.

like image 34
theDuncs Avatar answered Sep 30 '22 05:09

theDuncs