2017-05-03 18 views
2

我目前正在開發一個支持從右到左語言的項目。到目前爲止,通過Apple的RTL支持,我管理項目的%80以支持RTL。但是我堅持使用UICollectionView。右對齊UICollectionView使用兩個項目的水平滾動(用於RTL)

對於LTR語言一切工作正常,如下圖所示:

enter image description here enter image description here enter image description here

然而,當RTL如下的樣子激活,集合視圖成功加載,但是當它是試圖擴大或換句話說重新加載,我想,它再次扮演LTR的角色。我添加了慢動作gif,以便爲您提供一些關於行爲的信息。

enter image description here enter image description here enter image description here

任何想法,爲什麼會出現這種情況? 請不要,我提到this answer here,但它使用垂直滾動,而不是水平。

回答

0

- 您確定您在AutoLayout中的約束是正確的嗎? - 代替設置RTL, 首先在創建UICollectionView時對其執行水平翻轉。 [collectionView_ setTransform:CGAffineTransformMakeScale(-1, 1)];

然後befor返回方法CellForItemAtIndexPath中的單元格給單元格水平翻轉。

[cell setTransform:CGAffineTransformMakeScale(-1, 1)]; 

希望它能幫上忙。