在 iOS 6 UITextField 中是否有内置方法可以从右到左输入文本? [英] Is there a bulit in method to enter text from right to left in an iOS 6 UITextField?
本文介绍了在 iOS 6 UITextField 中是否有内置方法可以从右到左输入文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,如果我想输入 12345:
5
45
345
2345
12345
For instance, if I wanted to input 12345:
5
45
345
2345
12345
我可以尝试创建自己的方法来做到这一点,但我想知道是否有内置的方法来做到这一点.
I can try and create my own method to do this, but I was wondering if there is a built in way to do this.
推荐答案
有几种方法可以做到这一点.NSTextAlignmentRight
可能会满足您的需求:
There are a couple of ways to do this. NSTextAlignmentRight
will probably fit your needs:
[myTextField setTextAlignment:NSTextAlignmentRight];
但也有 setBaseWritingDirection:UITextWritingDirectionRightToLeft
.(还没有测试过这个,我不在我的电脑上)
But there is also setBaseWritingDirection:UITextWritingDirectionRightToLeft
. (Haven't tested this I'm not on my computer)
[myTextField setBaseWritingDirection:UITextWritingDirectionRightToLeft forRange:[myTextField textRangeFromPosition:[myTextField beginningOfDocument] toPosition:[myTextField endOfDocument]]];
这篇关于在 iOS 6 UITextField 中是否有内置方法可以从右到左输入文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文