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 of 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 do not understand anything 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 it, my methods and library are in Objective-c I tried to call some and worked, others not so much, so I preferred to continue with Objective-c.
Thanks for your help.