2014-11-17 8 views
0

UICollectionView Inside UICollectionViewCell을 사용하고 있습니다. 상단 CollectionView는 진실 방향 (왼쪽 < -> 오른쪽)으로 스크롤하고 내부 CollectionView는 가로 방향 (상단 < -> 하단)으로 스크롤합니다 ..부드러운 스크롤 UICollectionViewCell의 UICollectionView에서

위쪽 컬렉션 뷰를 스크롤하면 위로부터 아래로 스크롤하는 것이 부드럽 지 않습니다. 내부 CollectionView 스크롤.

맨 위로부터 CollectionView를 부드럽게 스크롤 할 수있는 방법이 있습니까? < -> Bottom?

최고 CollectionView 데이터 소스 방법

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 

static NSString *cellIdentifier = @"CellId"; 

CustomCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath] 

...... 

...... 

} 

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 
retrun 10; 

} 

**Within CustomCollectionViewCell Inner CollectionView Datasource** 

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 

static NSString *cellIdentifier = @"CellId"; 

CustomCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath] 

...... 

...... 

} 

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ 
retrun 10; 

} 
+0

여기서 내측 컬렉션 뷰에 대한 데이터 소스가 배치된다? – Alexi

+0

내부 UICollectionView에 대해 별도의 클래스를 유지하면 복잡성이 줄어들고 쉽게 해결할 수 있습니다. – bhanu

답변

0

실제로 무슨 일을하는 것은, 당신이 UICollectionViewCell의 내부 컨테이너가 ... 스크롤러 내가 바깥 중 하나를 스크롤해야 누구에게 찾을 수 UICollectionView을 사용하는 잘못된 접근입니다 즉, 루트 UICollectionView 또는 안에있는 UICollectionView을 제어합니다. 당신이 알아낼 수 있다면 당신은 다른 접근법을 시도 할 수 있습니다. 또는 몇 가지 샘플 코드가 있으면 좋을 것입니다.

+0

하단 UICollectionView에 제스처를 추가 할 수 있습니다. – user1068810

0

주 컬렉션 뷰 셀 내부의 컬렉션 뷰의 대리자 및 데이터 원본을 주 컬렉션 뷰 셀에 배치해도 아무런 문제가 없습니다.

컬렉션 뷰 셀 인터페이스 : 다음과 같이

@interface GalleryCell() 
<UICollectionViewDataSource, UICollectionViewDelegate> 
{ 
    NSArray *dataSourceArray; 
} 
@end 

및 구현 :

@implementation GalleryCell 

      #pragma - datasources 
      // Defines the number of cells in a section of collection view 
      - (NSInteger)collectionView:(UICollectionView *)cv numberOfItemsInSection:(NSInteger)section; 
      { 
       return dataSourceArray.count; 
      } 

      // Defines the cells in the collection view 
      - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath; 
      { 
       UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"cellId" forIndexPath:indexPath]; 
       return cell; 
      } 
    @end 
+0

메인 UICollectionViewCell 클래스 내에 내부 콜렉션 뷰 대리자 및 datasoure 메소드를 배치하고 있습니다. – harigharan