0
I’m creating a Uicollectionviewcontroller with 2 or 3 columns, when using autolayout in some devices works perfectly but in others not, I did not find anything that speaks how to dynamize these columns with objective-c.
I found one in Swift, which has this calculation.
private let leftAndRightPaddings: CGFloat = 30.0
private let numberOfItemsPerRow: CGFloat = 2.0
private let heigthAdjustment: CGFloat = 5.0
let width = (CGRectGetWidth(collectionView!.frame) - leftAndRightPaddings) / numberOfItemsPerRow
let layout = collectionViewLayout as! UICollectionViewFlowLayout
layout.itemSize = CGSizeMake(width, width + heigthAdjustment)
I don’t understand what this code is doing down here
let layout = collectionViewLayout as! UICollectionViewFlowLayout
with this reiderization code is working with Swift but I can not use, my methods and library are in Objective-c tried to call some and worked, others not so much, so I preferred to continue with Objective-c.
thanks...
valeu worked
– Fabricio Aguiar