What is the difference between NSLayoutAttributeLeft
and NSLayoutAttributeLeading
in iOS autolayouts?
1 Answers
"Leading" does not always mean "Left". For RTL-written languages (locales) leading edge of the object’s alignment rectangle will be located at the right side of the object.
Quote from Auto Layout Guide:
The attributes leading and trailing are the same as left and right for left-to-right languages such as English, but in a right-to-left environment such as Hebrew or Arabic, leading and trailing are the same as right and left. When you create constraints, leading and trailing are the default values. You should usually use leading and trailing to make sure your interface is laid out appropriately in all languages unless you’re making constraints that should remain the same regardless of language (such as the order of master and detail panes in a split view).

- 4,642
- 7
- 44
- 97

- 1,431
- 1
- 13
- 9
-
1Can you share any related link, it could be more helpful – Raj iOS Nov 14 '13 at 07:36
-
8There's not much more to be said. This is the correct answer. Leading is always where the text begins from - in English, the left, in Arabic, the right. – jrturton Nov 14 '13 at 07:46
-
1This attribute not work in iOS 8 , I tested now NSLayoutAttributeLeading and NSLayoutAttributeTrailing still didn't reflect to another side – wod Oct 15 '14 at 07:31
-
2So in the 99% of cases when you're working with UIViews that are not representing any language, they're the same, eh :P – jeremywhuff Jan 15 '15 at 23:44