让UICollectionView从右向左滚动?

Rob*_*way 4 iphone cocoa-touch objective-c uiscrollview uicollectionview

水平设置时UICollectionView滚动的自然方向是从左到右.有没有办法扭转这种局面?越简单越好.

rde*_*mar 9

我不确定你的意思 - 如果你将滚动设置为水平,它会向右和向右滚动.如果您希望它从右侧启动它,您可以使用此方法:

[self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:self.theData.count - 1 inSection:0] atScrollPosition:UICollectionViewScrollPositionRight animated:NO];
Run Code Online (Sandbox Code Playgroud)

这假定您有1个部分,填充集合视图的数组称为theData.