I'm having weird issue and I'm not sure why this happening.As you can see this both images one is of ios 9 running ipad and another is ios11 running ipad. for ios9 running ipad cell is not resizing. I search a lot but did't get a answer. Please help me with this and i also attached code.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! WalkthroughCollectionViewCell
let walkObject = walkObjects[indexPath.row]
cell.walkImageView.image = walkObject.image
cell.walkHeader.text = walkObject.Header
cell.walkDetails.text = walkObject.Details
cell.getStartedButton.addTarget(self, action: #selector(getStarted(sender:)), for: .touchDown)
if (indexPath.row + 1) == walkObjects.count {
cell.getStartedButton.isHidden = false
}else{
cell.getStartedButton.isHidden = true
}
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: collectionView.frame.width, height: collectionView.frame.height)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0.0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 0.0
}
In my case, I changed Estimate Size
from Automatic
to None
and using:
collectionView(_ collectionView: UICollectionView, layout
collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath:
IndexPath) -> CGSize
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With