【问题标题】:Want to align the text from the rightside..(UITextALignmentRight)想要从右侧对齐文本..(文本对齐右)
【发布时间】:2012-04-06 22:57:03
【问题描述】:

我使用UITextViewinputView 创建了一个键盘。

我想对齐来自UItextAlignmentRight 的文本,但它不起作用,因为它在使用inputView 时没有调用UITextViewDelegate 方法。

任何帮助将不胜感激。

【问题讨论】:

    标签: objective-c keyboard uitextview uitextviewdelegate inputview


    【解决方案1】:

    这可能对在设置 UITextView 的 textAlignment 时遇到问题的人有所帮助。我尝试了不同的 Unicode 方向字符,发现:

    1. 当您将 textView 的 textAlignment 属性设置为 UITextAlignmentRight 时,如果您的文本以从左到右的强字符开头,则从右到左调整可以正常工作。例如:

      self.textView.text = [@"\u200e\u202b" stringByAppendingString: yourRtLstring];
      
    2. 如果您不设置 textView 的 textAlignment 属性(或设置为默认的 UITextAlignmentLeft),则从右到左调整适用于强 RtL 字符。

    【讨论】:

      【解决方案2】:
      1. 检查您的 ViewController 是否正在实现 UITextViewDelegate 协议

      2. 将 UITextView 上的 UITextAlignment 属性设置为 UITextAlignmentRight

      3. 你用的是哪一种 UITextViewDelegate 方法?

      【讨论】:

        猜你喜欢
        • 2016-09-21
        • 1970-01-01
        • 1970-01-01
        • 2013-07-23
        • 2020-10-17
        • 2011-05-13
        • 2012-06-29
        • 2020-01-26
        • 2013-03-03
        相关资源
        最近更新 更多