ios - UILabel text issue -
i have issue label text. label text not dislay text thats get. put nslog , able see text, label 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 nslog text:
and uilabel text:
the marked text @ nslog missing uilabel.. sorry language.
what cause problem? gooing crazy, tried everything!! in advance!
there few reasons why label won't display text
- frame size, looks cover especaily since can see of text
- the font/size/wording big , in turn doesn't have enough space show text.
in case suggest looking @ font or font size.
Comments
Post a Comment