1

I have a UITextView that has the property UITextAlignmentNatural but I want to know if the text is aligned left-to-right or right-to-left. How can I tell if it's LTR or RTL

For more context, I'm trying to do this within my NSLayoutManager subclass because I'd like to highlight the left-to-right and right-to-left cases with special formatting / outline.

MichaelGofron
  • 1,310
  • 4
  • 15
  • 29
  • 1
    Check this topic -> https://stackoverflow.com/questions/11352342/ios-determine-if-device-language-is-right-to-left-rtl – Piotr Golinski Jul 20 '18 at 08:20
  • That method doesn't really work. For a UIView the `UISemanticContentAttribute` is generally `UISemanticContentAttributeUnspecified` which flips the view if it's RTL and leaves it as is for LTR. I'd like to know if I'm dealing with RTL or LTR which I can't possibly know from the attribute `UISemanticContentAttributeUnspecified` – MichaelGofron Jul 20 '18 at 17:28
  • I'm curious if there's some way to tell if the view is right to left or left to right when `UISemanticContentAttributeUnspecified` is specified. – MichaelGofron Jul 20 '18 at 17:35

0 Answers0