Sunday, November 8, 2026
HomeiOS Developmentios - Swift - UICollectionView content material disappear whereas scrolling

ios – Swift – UICollectionView content material disappear whereas scrolling

[ad_1]

after updating from swift 4 to swift 5, my UICollectionView disappearing whereas scrolling (ONLY horizontal view ) as a result of within the gif file there’s one other UICollectionView nevertheless it’s vertical, I did not face this downside in swift 4, I searched stack overflow and I noticed a variety of reply nevertheless it did not helped me ,

this can be a gif. file present the proccess

that is my heightForRowAt perform

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    change indexPath.part {
    case 0:
        return UITableView.automaticDimension
        
    case 1:
        return 200
    case 2:
        return UITableView.automaticDimension
        
    case 3:
        if (self.topAlbumsArray.isEmpty){
            return 300.0
        }else{
            
            return 120.0
        }
        
        
    default:
        return 280
    }
}

that is the collectionView perform

        func collectionView(_ collectionView: UICollectionView, format collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {

          return CGSize(width: 150, peak: 200)

      }
      func collectionView(_ collectionView: UICollectionView, format collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt part: Int) -> CGFloat {
          return 8
      }
  
      func collectionView(_ collectionView: UICollectionView, format collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt part: Int) -> CGFloat {
          return 8
      }
      func collectionView(_ collectionView: UICollectionView, format collectionViewLayout: UICollectionViewLayout, insetForSectionAt part: Int) -> UIEdgeInsets {
          return UIEdgeInsets(prime: 0, left: 10, backside: 0, proper: 0)
      }

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments