Search code examples
ioscocoa-touchtext-alignment

How do I set textalignment property to right in uiwebview in IOS?


I am rendering data from the service in the uiwebview, but i need to show the content in the webview from right to left, how to do that i have tried the following thing, but it doesnot apply to the content.

Here is my code.

[webView loadHTMLString:[NSString stringWithFormat:
                         @"<div align='right'>%@<div>",configdata] baseURL:nil];

If any code changes is there please help me. thank you in advance.


Solution

  • I dot the solution for my answer, this is the code.

    [webView loadHTMLString:[NSString stringWithFormat:@"<div dir='rtl'>%@<div>",configdata] baseURL:nil];
    

    Here use dir = 'rtl', it resolved my question.