0

Would someone please tell me why my collection view is stacking like this instead of side-by-side (until there's no more room and a new row has to be started)? I don't want them stacking with only one per row.

Collection View

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        claimSections.count
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        
        guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionViewCell", for: indexPath) as? ClaimTypeCollectionCell else {return UICollectionViewCell()}
        
        cell.claimTypeCollectionImage.image = claimSectionImages[indexPath.row]
        cell.claimTypeCollectionLabel.text = claimSections[indexPath.row]
        cell.frame.size.height = 135
        cell.frame.size.width = 135
        cell.layer.borderWidth = 2
        cell.layer.borderColor = UIColor.black.cgColor
        
        return cell
    }
    
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        if indexPath.row == 0 {
            // The Auto button was tapped -> load the auto page
            modelController.theClaimType = "Auto"
            modelController.isANewFile = true
            performSegue(withIdentifier: "claimTypeToFileSetupSegue", sender: self)
        } else {
            SCLAlertView().showNotice("COMING SOON!", subTitle: "This section is not yet available. It will be soon!")
        }
    }
Christian W
  • 353
  • 2
  • 12

1 Answers1

0

enter image description here

Scorll Direction -> Horizontal

bdeviOS
  • 449
  • 1
  • 6