4

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. ios9 running Deviceios11 running Device

 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
} 
jay patel
  • 238
  • 2
  • 14

2 Answers2

24

enter image description here

In my case, I changed Estimate Size from Automatic to None and using:

 collectionView(_ collectionView: UICollectionView, layout
 collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath:
 IndexPath) -> CGSize
Senocico Stelian
  • 1,378
  • 15
  • 23
0

OK, I don't why but it's working now. i just set NavigationBarHidden false. it started working.

jay patel
  • 238
  • 2
  • 14
  • 1
    Yes, Because i don't want to show navigation bar in this view that's why i set hidden and but now i think i need to show it for older version only. – jay patel Dec 13 '17 at 06:44