Using Objective C and Xcode I have created a UICollectionView
with 10 sections and all works fine. Is there anyway to set the section to which is viewed when first shown? By default it shows sections 0-9, but I want it to start at section 5.
You can call scrollToItemAtIndexPath:atScrollPosition:animated:
in your viewDidAppear:
method.
You can hold a reference to the cell you want to scroll to, then use indexPathForCell:
to get the index path.
The following are the scroll positions you can choose from
UICollectionViewScrollPositionNone
UICollectionViewScrollPositionTop
UICollectionViewScrollPositionCenteredVertically
UICollectionViewScrollPositionBottom
UICollectionViewScrollPositionLeft
UICollectionViewScrollPositionCenteredHorizontally
UICollectionViewScrollPositionRight
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With