如何在ObjC中滚动并行两个uicollectionview

时间:2015-12-01 05:39:12

标签: ios uicollectionview

我想同时滚动SELECT * FROM Table1 WITH (NOLOCK) inner join Table2 WITH (NOLOCK) on Table1.field1 = Table2.field2 inner join Table3 WITH (NOLOCK) on Table1.field2 = Table3.field3 。当我滚动第一个集合视图然后滚动底部UIcollectionview(Collectionview2)。

目前我正在使用 scrollViewDidEndDecelerating 方法,但它无法正常工作。 请为此提供任何消息。

see Image...

目前我正在使用以下代码......

UICollectionView

1 个答案:

答案 0 :(得分:1)

你也可以使用collectionview代表就像你使用两个集合视图collectionview.tag == 101和collectionview.tag == 102。 在您的第一个集合视图中,三个单元格正在显示

- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{

NSLog(@"%li",(long)indexPath.row);

if(collectionView.tag == 101){

    if(fmod(indexPath.row, 3) == 1 && indexPath.row != 1){

        if (scrollDirection == ScrollDirectionLeft) {
        [self.collectionView2 setContentOffset:CGPointMake(currScrollXPos+300, 0) animated:YES];
        currScrollXPos = currScrollXPos+300;
        }
        if (scrollDirection == ScrollDirectionRight) {
            [self.collectionView2 setContentOffset:CGPointMake(currScrollXPos-300, 0) animated:YES];
            currScrollXPos = currScrollXPos-300;
        }
    }

}