2015-05-11 17 views

Odpowiedz

7

można użyć poniższy kod aby przewinąć UICollectionView programowo do dolnej

NSInteger section = [self numberOfSectionsInCollectionView:collectionView] - 1; 
NSInteger item = [self collectionView:collectionView numberOfItemsInSection:section] - 1; 
NSIndexPath *lastIndexPath = [NSIndexPath indexPathForItem:item inSection:section]; 
[collectionView scrollToItemAtIndexPath:lastIndexPath atScrollPosition:UICollectionViewScrollPositionBottom animated:YES]; 
0

Ustaw contentoffset.y obiektu widoku kolekcji.

1
NSIndexPath *lastItem = /*Indexpath of last item*/; 
[self.collectionView scrollToItemAtIndexPath:lastItem atScrollPosition:UICollectionViewScrollPositionBottom animated:YES]; 
0

Ci ten kod do scoll dół.

NSArray *visibleItems = [self.collectionView indexPathsForVisibleItems]; 
    NSIndexPath *currentItem = [visibleItems objectAtIndex:0]; 
    NSIndexPath *nextItem = [NSIndexPath indexPathForItem:currentItem.item + 1 inSection:currentItem.section]; 
    [self.collectionView scrollToItemAtIndexPath:nextItem atScrollPosition:UICollectionViewScrollPositionTop animated:YES]; 
Powiązane problemy