Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8030799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:53:08+00:00 2026-06-05T00:53:08+00:00

Using my custom arabic keyboard on UItextView inputView, I m filling my textView with

  • 0

Using my custom arabic keyboard on UItextView inputView, I m filling my textView with the arabic text but cannot get the written text align to right….Need help to align text to right.

-(BOOL)textViewShouldBeginEditing:(UITextView *)textView{

 if(showCustomKeyboard==NO){
 [textView resignFirstResponder];
 textView.inputView=nil;
 [textView becomeFirstResponder];
 return YES; 
}

 else{
     [textView resignFirstResponder];
     if(customKeyboard==nil){
     customKeyboard=[[CustomKeyboard alloc] initWithFrame:CGRectMake(0, 264, 320, 216)];
     [customKeyboard setDelegate:self];
 } 
 if([[UIApplication sharedApplication] respondsToSelector:@selector(inputView)]){
     if (textView.inputView == nil) {
           textView.inputView = customKeyboard;
           [textView becomeFirstResponder];
     }
 } 
    self.customKeyboard.currentField=textView;
    [textView becomeFirstResponder];
 }
 return YES; 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:53:10+00:00Added an answer on June 5, 2026 at 12:53 am

    You can set the writing direction of a UITextView using the setBaseWritingDirection selector:

    UITextView *someTextView = [[UITextView] alloc] init];
    [someTextView setBaseWritingDirection:UITextWritingDirectionLeftToRight forRange:[someTextView textRangeFromPosition:[someTextView beginningOfDocument] toPosition:[someTextView endOfDocument]]];
    

    The code is a little tricky because UITextView supports having different parts of the text with different writing directions. In my case, I used [someTextView textRangeFromPosition:[someTextView beginningOfDocument] toPosition:[someTextView endOfDocument]] to select the full text range of the UITextView. You can adjust that part if your needs are different.

    You may also want to check whether the text in your UITextView is LTR to RTL. You can do that with this:

    if ([someTextView baseWritingDirectionForPosition:[someTextView beginningOfDocument] inDirection:UITextStorageDirectionForward] == UITextWritingDirectionLeftToRight) {
        // do something...
    }
    

    Note that I specified the start of the text using [someTextView beginningOfDocument] and searched forward using UITextStorageDirectionForward. Your needs might differ.

    If you subclass UITextView replace all these code samples with “self” and not “someTextView”, of course.

    I recommend reading about the UITextInput protocol, to which UITextView conforms, at http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextInput_Protocol/Reference/Reference.html.

    Warning about using the textAlignment property in iOS 5.1 or earlier: if you use it with this approach together with setting the base writing direction, you will have issues because RTL text when aligned left in a UITextView actually aligns to the right visually. Setting text with an RTL writing direction to align right will align it to the left of the UITextView.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an application that requires arabic text to be displayed, using custom
I am trying to seed some data using custom database initializers, but can't get
I'm using custom renderer on JList, but none of components rendered are accessible. list.setCellRenderer(new
I have a custom block for Arabic content using PHP input format, and tested
i am using custom cell in uitableview cell.I am giving button on the right
I am using custom InfoPath task form in my project. All works fine, but
I am using custom background for my Tab layout, but it displaying something different.
I am using custom code to print the comments but the problem is whatever
I want to Create a new User using Custom Membership Provider but I don't
I am using a google maps custom control. I would like a text link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.