2016-05-01 40 views
2

我正在用UICollectionView構建自定義日曆視圖。一切都很好,但是當我嘗試測試語言設置爲阿拉伯語時,單元格從右到左列出。有沒有辦法在RTL模式下禁用它。 我檢查了文檔,但沒有這樣的選項。爲UICollectionView禁用RTL方向

+0

你爲什麼想這樣做? – wakachamo

回答

8

您可以通過設置視圖語義屬性 你必須把它放在UICollectionView 禁用它存在UIView類

semanticContentAttribute 

屬性具有以下值

UISemanticContentAttributeUnspecified = 0, 
UISemanticContentAttributePlayback, 
UISemanticContentAttributeSpatial, 
UISemanticContentAttributeForceLeftToRight, 
UISemanticContentAttributeForceRightToLeft 

enter image description here

+0

真棒,非常感謝。 –

+0

你知道如何在代碼中做到這一點嗎? –

+1

@swiftnub我已更新我的代碼設置此屬性的答案。 – Imran