从右到左对齐

时间:2013-11-25 16:10:40

标签: ios json right-to-left

我正在为我的网站制作一个json reeder,我想从右到左制作帖子内容 我怎样才能让“内容”从右到左? 我想做的事情显示内容部分从右到左,我不能使用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

0 个答案:

没有答案