I have problem with text right alignment . Actually in my DetailedViewController there is UILabel
Called "lblnNewsTitle"
, For this Lable i am trying to set NSTextAlignmentRight but it doesn't work for me . can any one help me to solve this issue ?
Screenshot 1:
Screenshot 2 :
My Storyboard screenshot 3 :
Here is My Code :
- (void)viewDidLoad
{
[DetailTittle setFont:[UIFont fontWithName:@"GEEast-ExtraBold" size:12]];
[super viewDidLoad];
[self.lblDescription setNumberOfLines:0];
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320, 765)];
self.txtViwNews.text=self.strDescription;
self.lblnNewsTitle.text=self.strTitle;
self.lblnNewsTitle.font=[UIFont fontWithName:@"GEEast-ExtraBold" size:14];
self.txtViwNews.font=[UIFont fontWithName:@"GE SS Unique" size:12];
self.lblnNewsTitle.textAlignment = NSTextAlignmentRight;
self.txtViwNews.textAlignment= NSTextAlignmentRight;
self.lblDateinDetail.text=self.strDate;
self.lblDateinDetail.font=[UIFont fontWithName:@"GEEast-ExtraBold" size:14];
self.lblDateinDetail.textColor=[UIColor blackColor];
[lblnNewsTitle setNumberOfLines:0];
[lblnNewsTitle sizeToFit];
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:self.strDetailImage]];
self.strImage.image = [UIImage imageWithData:data];
// Set border color and width of image
[_strImage.layer setBorderColor:[UIColor blackColor].CGColor];
[_strImage.layer setBorderWidth:1.0];
self.lblDescription.font=[UIFont fontWithName:@"GE SS Unique" size:kLblIntalFont];
self.lblDescription.textAlignment = NSTextAlignmentRight;
[self estimatedHeight:kLblIntalFont];
if (_strImage.image == nil)
{
[_strImage.layer setBorderColor:[UIColor blackColor].CGColor];
[_strImage.layer setBorderWidth:0];
[self.lblnNewsTitle setNumberOfLines:0];
self.lblnNewsTitle.frame = CGRectMake(self.lblnNewsTitle.frame.origin.x, self.lblnNewsTitle.frame.origin.y, self.lblnNewsTitle.frame.size.width, self.lblnNewsTitle.frame.size.height );
self.viwMidImage.frame=CGRectMake(self.viwMidImage.frame.origin.x, self.strImage.frame.origin.y, self.viwMidImage.frame.size.width, self.viwMidImage.frame.size.height);
[self.lblDescription setNumberOfLines:0];
[self.lblDescription sizeToFit];
self.lblDescription.frame = CGRectMake(self.lblDescription.frame.origin.x, self.viwMidImage.frame.origin.y+ self.viwMidImage.frame.size.height,self.lblDescription.frame.size.width,self.lblDescription.frame.size.height );
self.lblDescription.textAlignment = NSTextAlignmentRight;
}
else {
// if (!cell.imgNews ==nil)
self.lblnNewsTitle.frame = CGRectMake(self.lblnNewsTitle.frame.origin.x, self.lblnNewsTitle.frame.origin.y, self.lblnNewsTitle.frame.size.width, self.lblnNewsTitle.frame.size.height );
[self.lblDescription setNumberOfLines:0];
[self.lblDescription sizeToFit];
}
}