2017-02-22 3 views
0

2 개의 섹션이있는 collectionView가 있습니다. 각 섹션에는 두 세트의 이미지가 있습니다. 두 섹션 모두에 제목을 지정하고 싶습니다. 이것과 함께, 나는 또한 스크롤 방향을 수평으로하고 싶다. 스크롤 은, 내가 사용했습니다 :CollectionView Swift 3.0에서 섹션 제목 지정?

if let layout = collectionFavourites.collectionViewLayout as? UICollectionViewFlowLayout { 
      layout.scrollDirection = .horizontal 

이 그러나, 그들 중 하나에 때 사용자가 스크롤 simulataneously 섹션을 모두 스크롤됩니다.

, 나는 다음 코드를 사용했습니다이이 섹션에서 내 데이터를 polulate하려면

switch indexPath.section 
     { 

     case 0: 
      gTableFavouriteImagesIndexArray.sort()) 
      let index = gTableFavouriteImagesIndexArray[indexPath.row] 
      let dictImage = gTableImageArray[index] 
      lblTitle.text = dictImage["Title"] as! String? 
      imgView.image = dictImage["image"] as! UIImage? 
     default: 
      gCollectionFavouriteImagesIndexArray.sort() 
      let index = gCollectionFavouriteImagesIndexArray[indexPath.row] 
      let dictImage = gCollectionImageArray[index] 
      lblTitle.text = dictImage["Title"] as! String? 
      imgView.image = dictImage["image"] as! UIImage? 
     } 

나는 다른에 대한 상승과 하락에 한 부분의 이미지를 원한다. 그러나 나는 그들 모두를 똑같은 부분으로 belomng하는 것처럼 그들 모두를 얻고있다. 이 문제에 대해 도와주세요.

답변

1

두 개의 섹션 (섹션 당 한 행)이있는 tableView를 사용하면이 작업을 수행 할 수 있습니다. 그런 다음 두 세트의 이미지를 보유 할 섹션 모두에 collectionView를 작성하십시오.