Mam UICollectionView
. Chcę przewinąć do dołu, gdy pojawi się widok. Jak to zrobić?Jak przewinąć program UICollectionView na dół?
Czy ktoś może mi pomóc? Z góry dzięki.
Mam UICollectionView
. Chcę przewinąć do dołu, gdy pojawi się widok. Jak to zrobić?Jak przewinąć program UICollectionView na dół?
Czy ktoś może mi pomóc? Z góry dzięki.
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];
Ustaw contentoffset.y
obiektu widoku kolekcji.
NSIndexPath *lastItem = /*Indexpath of last item*/;
[self.collectionView scrollToItemAtIndexPath:lastItem atScrollPosition:UICollectionViewScrollPositionBottom animated:YES];
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];