Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the writing direction in iPhone UITextView or UITextField

Right now if you type something in a right to left language and tap and hold, the copy and paste menu will have an extra option for changing the writing direction form "left to right" to "right to left".

I want to set this option in the code so that my UITextView writing direction would be right to left by default.

Does anyone know how I can do that. I searched all over the web and SDK and tried everything with no luck. I would be grateful if anyone can help.

like image 553
Allen Bargi Avatar asked Dec 12 '09 16:12

Allen Bargi


People also ask

What is Uitextfield?

An object that displays an editable text area in your interface.

How do you make a text field non editable in Swift?

Set the Boolean variable to true, which disables editing in the text field.


2 Answers

check may be this will help you.

setTextAlignment:UITextAlignmentRight;

like image 159
Syed Faraz Haider Zaidi Avatar answered Oct 28 '22 18:10

Syed Faraz Haider Zaidi


Hope this can help

divide the text in the UITextView by line,and change NSString from "left to right" to "right to left" is quite simple

like image 34
Stan Avatar answered Oct 28 '22 16:10

Stan