ios - Setting UICollectionView frame at runtime -


i trying set frame of uicollectionview @ runtime.

i tried using

maincollectionview.frame = cgrect(x: 20, y: 20, width: self.view.frame.width-20, height: self.view.frame.width-20) 

in viewdidload unfortunately stay in ib. not yet using constraints.

otherwise resizing cells working in cellforitem:

 collectioncell.frame.size.width = self.view.frame.width/8 * 3 

try set frame in viewdidlayoutsubviews


Comments