Reputation: 6971
I need to know the direction of a text depending on the language of the keyboard when typing in a UITextView. For example, if the user is typing in english, then the direction will be "left to right" and if the user is typing in arabic, "right to left". I need that value without doubts and avoiding to hardcoding a matching between each language and its text direction.
Is this possible?
Upvotes: 4
Views: 702
Reputation: 14766
Check this out this method from UITextInput Protocol:
- (UITextWritingDirection)baseWritingDirectionForPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction
This returns a constant that represents a writing direction (for example, left-to-right or right-to-left)
UITextView implements such protocol.
Upvotes: 4