i have an issue with the label text. the label text not dislay all the text thats he get. i put a NSlog and i were able to see all the text, but the label for some reasom cant.
my code:
-(void)viewDidLoad
{
[super viewDidLoad];
[_scroller setScrollEnabled:YES];
[_scroller setContentSize:CGSizeMake(250, 420)];
self.description = [_description stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ([self.description isEqualToString:@""]) {
self.description = @"ללא תקציר";
}
[self positionLabel:self.lblTitle withText:self.stitle withY:10];
[self positionLabel:self.lblPubDate withText:self.pubDate withY:CGRectGetMaxY(self.lblTitle.frame)+10 ];
[self positionLabel:self.lblDescription withText:self.description withY:CGRectGetMaxY(self.lblPubDate.frame)+25 ];
-(void)positionLabel:(UILabel*)lbl withText:(NSString*)text withY:(CGFloat)Y
{
lbl.textAlignment = UITextAlignmentRight;
lbl.text = text;
lbl.numberOfLines = 0;
lbl.lineBreakMode = UILineBreakModeWordWrap;
CGSize size = [self calculateSize:lbl];
[lbl setFrame:CGRectMake(10 , Y , (size.width>300)?size.width:300 , size.height)];
[_scroller addSubview:lbl];
}
-(CGSize)calculateSize:(UILabel*)lbl
{
CGSize size = [lbl.text sizeWithFont:lbl.font
constrainedToSize:CGSizeMake(280, MAXFLOAT)
lineBreakMode:UILineBreakModeWordWrap];
return size;
}
EDIT
here is the NSlog text:
and the UILabel text:
the marked text at the NSLog is missing the UILabel.. sorry for the language.
what could cause the problem? i gooing crazy, i tried everything!! Thanks in advance!