-1
我想同時滾動兩個UICollectionView
。當我滾動第一個集合視圖,然後滾動底部UIcollectionview(Collectionview2)。如何在ObjC中滾動並行兩個uicollectionview
目前我正在使用scrollViewDidEndDecelerating方法,但它不能正常工作。 請給予任何消化。
目前我使用下面的代碼...
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
CGPoint centerPoint = CGPointMake(self.clnViewWorkoutTitles.center.x + self.clnViewWorkoutTitles.contentOffset.x,
self.clnViewWorkoutTitles.center.y + self.clnViewWorkoutTitles.contentOffset.y);
NSIndexPath *centerCellIndexPath = [self.clnViewWorkoutTitles indexPathForItemAtPoint:centerPoint];
[self.clnViewWorkoutContent scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:centerCellIndexPath.item inSection:0] atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];
[self.clnViewWorkoutTitles scrollToItemAtIndexPath:centerCellIndexPath atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];}
你能顯示當前的代碼,你有嗎? –
@Otávio肯定請檢查我已更新的問題。 – Vvk
我可以在你的屏幕截圖上看到_cells_;第一個集合視圖在哪裏?第二個在哪裏? _「不能正常工作」_是什麼意思?它是如何工作的?你期望什麼? – holex