0

I created a keyboard using on UITextView's inputView.

I want to align the text from the UItextAlignmentRight but it's not working as it is not calling the UITextViewDelegate method when using inputView.

Any help will be appreciated.

tomferon
  • 4,993
  • 1
  • 23
  • 44
Khalil Ghaus
  • 251
  • 1
  • 3
  • 15

2 Answers2

1

This might be helpful to people who are experiencing problems with setting of textAlignment for UITextView. I experimented with different Unicode directional characters and found that:

  1. When you set textAlignment property of textView to UITextAlignmentRight, right to left adjustment works correctly if you start your text with a strong left to right character. For example:

    self.textView.text = [@"\u200e\u202b" stringByAppendingString: yourRtLstring];
    
  2. If you don't set the textAlignment property of textView (or set to default UITextAlignmentLeft), right to left adjustment works correctly for strong RtL characters.

j0k
  • 22,600
  • 28
  • 79
  • 90
hjk
  • 21
  • 1
  • 3
0
  1. CHeck if your ViewController is implementing the UITextViewDelegate protocol

  2. Set the UITextAlignment property on the UITextView to UITextAlignmentRight

  3. Which method of UITextViewDelegate are you using?

Jean
  • 2,611
  • 8
  • 35
  • 60