How can i get writing language of uitextview? or how can i know uitextview is right to left or left to right in current state?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
[textView baseWritingDirectionForPosition:[textView beginningOfDocument] inDirection:UITextStorageDirectionForward] == UITextWritingDirectionRightToLeft
Should return true if the UITextView
is right-to-left, and false otherwise.
Further documentation can be found here, if you need it!
回答2:
In answer to your other question, you can get the keyboard language used from UITextInputMode
docs: http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextInputMode_Class/Reference/Reference.html
回答3:
This solution worked better for me
[NSLocale characterDirectionForLanguage:self.textView.textInputMode.primaryLanguage] == NSLocaleLanguageDirectionRightToLeft