ios - Xcode 7 : Autolayout to UICollectionViewCell that are generated programmatically -


i've collectionview generates 9 collectionview cell @ run-time (set programmatically).

there 1 collectionview cell in storyboard.

i've question how set constraint cell such appears shown in screenshot.

screenshot

since layout showing there 3 cells per row. need divide collection view width 3 plus space separators. 1 way attached collection view left right top bottom autolayout. , use dummy cell label center. need work programmatically on delegate.

 - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath {     cgfloat screenwidth = collectionviewframe.size.width;     float cellwidth = screenwidth / 3.0 - 20; //replace divisor column count requirement. make sure have in float.     cgsize size = cgsizemake(cellwidth, cellwidth);      return size; } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -