-2

I'm trying to change the navigation from the UICollectionView from up to down to from right to left:

I tried:

self.collectionView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;

But did work. Still works from up to down

enter image description here I'm trying to do something similar to the photo app.

user2924482
  • 8,380
  • 23
  • 89
  • 173
  • 1
    This has already been answered here: http://stackoverflow.com/a/32292660/6658553 – nathangitter May 05 '17 at 19:39
  • @nathan, that is in swift. Here is the objective-C version: UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; – user2924482 May 05 '17 at 20:22

1 Answers1

0

If you try above line of code in your project it changes the content of the collection view from right to left only. But if you need to scroll from right to left follow the below code.It works perfectly.

I tried the blow line of code in two sample project.As it works perfectly I post the answer here.

//Scroll From Right to Left
[self.yourCollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:array.count - 1 inSection:0] atScrollPosition:UICollectionViewScrollPositionRight animated:NO];

I set above code in viewDidLoad method.

user3182143
  • 9,459
  • 3
  • 32
  • 39