1

I'm Making a json reeder for my web and i want to make post contents right to left how can i make "Content" Right to Left? I Want to do somthing that shows Content part Right To Left and i cant use settextalignment

#import "LHDetailViewController.h"
#import <Twitter/Twitter.h>

@implementation LHDetailViewController

@synthesize headline   = _headline;
@synthesize author     = _author;
@synthesize content    = _content;
@synthesize scrollView = _scrollView;
@synthesize adView     = _adView;
@synthesize articleAuthor  = _articleAuthor;
@synthesize articleContent = _articleContent;
@synthesize articleDate    = _articleDate;
@synthesize articleTitle   = _articleTitle;
@synthesize articleUrl     = _articleUrl;

- (void)viewDidLoad
{
    [super viewDidLoad];
    // setup the toolbar
    [[self navigationItem] setTitle:_articleDate];
    [[[self navigationController] navigationBar] setBackgroundImage:[UIImage imageNamed:@"bg_toolbar_only.png"] forBarMetrics:UIBarMetricsDefault];

    // setup the title
    [_headline setText:_articleTitle];
    [_headline setNumberOfLines:0];
    [_headline sizeToFit];

    // setup the author
    CGFloat authorYPosition = _headline.frame.size.height + 15.0f;
    [_author setFrame:CGRectMake(_headline.frame.origin.x, authorYPosition, 301.0f, 21.0f)];
    [_author setText:[NSString stringWithFormat:@"نویسنده: %@", _articleAuthor]];

    // setup the content
    CGFloat contentYPosition = authorYPosition + _author.frame.size.height + 20.0f;
    [_content loadHTMLString:_articleContent baseURL:nil];
    [_content setFrame:CGRectMake(_headline.frame.origin.x, contentYPosition, 320, _content.scrollView.contentSize.height)];
    [[_content scrollView] setScrollEnabled:YES];

    // setup the scroll view
    CGFloat scrollViewSize = contentYPosition + _content.frame.size.height;
    [_scrollView setContentSize:CGSizeMake(_content.frame.size.width, scrollViewSize)];
    [_scrollView setScrollEnabled:NO];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    [self setHeadline:nil];
    [self setAuthor:nil];
    [self setContent:nil];
    [self setScrollView:nil];
}

#pragma mark - implement action

#pragma mark - ADBannerViewDelegate
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{

}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{

}

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
    return YES;
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
}

@end
STF
  • 1,485
  • 3
  • 19
  • 36
user3025548
  • 31
  • 1
  • 4
  • possible duplicate of [Change the UITextView Text Direction](http://stackoverflow.com/questions/4905500/change-the-uitextview-text-direction) – thegrinner Nov 25 '13 at 16:12
  • @thegrinner how so? While it's not explicitly mentioned, `_content` appears to be of type `UIWebView` – JustSid Nov 25 '13 at 16:15
  • Is `content` a `UITextLabel` or `UITextView` or ...? If it's a `UIWebView` as @JustSid said, then you can set the alignment attribute in a pattern `HTML/CSS` file. But `Xcode` has improved `RTL` features quite well in recent versions. – Neeku Nov 25 '13 at 16:15
  • @JustSid Gah, I was looking at `_author` - my eyes jumped to the Arabic(?) text. – thegrinner Nov 25 '13 at 16:18
  • It is a UIWebView.So What Should I do? – user3025548 Nov 25 '13 at 16:24

0 Answers0