1

I am trying to implement right to left flow of cells in my UICollectionView using swift. I tried layoutAttributesForItemAtIndexPath but it does not work. Here is my method.

func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes! {

    var layOutAttributes : UICollectionViewLayoutAttributes!
    if indexPath.item % 3 == 0 {
        layOutAttributes.frame = CGRectMake((self.namesCollectionView.frame.width * 2)/3 , (self.namesCollectionView.frame.width * 2) / 3, self.namesCollectionView.frame.width/3, namesCollectionView.frame.width/3)
    }

    return layOutAttributes
}

Need a direction how can I achieve right to left flow?

Saqib Omer
  • 5,387
  • 7
  • 50
  • 71
  • 1
    Are you looking for something [answered by this Q&A](http://stackoverflow.com/questions/25598194/aligning-right-to-left-on-uicollectionview)? – rob mayoff Jun 03 '15 at 05:50
  • Yes. But I have square cell that fills CollectionView. I have already tried the link you gave me but it is not working. I was getting error while setting 'setTransform' on CollectionView. – Saqib Omer Jun 03 '15 at 07:29
  • 1
    use this: YourCollectionView.semanticContentAttribute = UISemanticContentAttribute.forceRightToLeft – Amir Shabani Jul 10 '17 at 11:41

0 Answers0