Get writing language of “uitextview” iphone?

北城余情 提交于 2019-12-02 01:48:56

问题


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


来源:https://stackoverflow.com/questions/13433733/get-writing-language-of-uitextview-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!