Semantic is the second property on the UIView's Attribute Inspector. Also called semanticContentAttribute in code.
Semantic means "relating to meaning in language or logic".
This seems like a poorly chosen word since, as you will see, this has more to do with languages rather than meanings in languages.
Using the Semantic property you can override this default behavior.
Semantic means "relating to meaning in language or logic".
This seems like a poorly chosen word since, as you will see, this has more to do with languages rather than meanings in languages.
Semantic
When your app is used on a device that is set to a language that reads from right to left (like Arabic), iOS will automatically flip controls to the other side of the screen to help make it more natural looking for those users.Using the Semantic property you can override this default behavior.
How to Flip
- Provide a leading and trailing constraint
- Leave label/textview's text alignment on "Natural":
Flipping Images
Thanks to wakachamo (comments below) I learned that you can flip images through the assets catalog.Prevent Flipping
- Manually setting a label/textview's text alignment
- If you have constraints on controls, you may have to change the parent's Semantic property from "Unspecified"
- Changing the Semantic property to anything but "Unspecified"
Other Observations/Notes
- Apple Doc: Supporting Right-To-Left Languages
- Apple Doc: UIView
If images are in an asset catalog, you can mark them as automatically flippable using the 'Direction' property. :)
ReplyDeleteWhoah, that's awesome! Great tip!
DeleteUpdated. Thanks again, wakachamo!
Delete