iphone - iOS change number lines of label -


i tried code number of lines 1 label.

i did :

[lblname setfont:[uifont fontwithname:@"opensans-condensedlight" size:19]]; [lblname settext:[objet titre]]; [lblname setlinebreakmode:nslinebreakbywordwrapping]; lblname.numberoflines = 2; 

but it's not running, i've 1 line...

someone me plz ?

for set dynamic frame uilabel use following method

-(void) setdynamicheightoflabel:(uilabel *) mylabel withlblwidth:(cgfloat) width andfontsize:(int) fontsize {     cgsize mylabelsize = cgsizemake(width, flt_max);     cgsize expecteingmylabelsize = [mylabel.text sizewithfont:mylabel.font constrainedtosize:mylabelsize linebreakmode:mylabel.linebreakmode];     cgrect lblframe = mylabel.frame;     lblframe.size.height = expecteingmylabelsize.height;     mylabel.frame = lblframe;     int addressline = mylabel.frame.size.height/fontsize;     mylabel.numberoflines = addressline; } 

in above method need pass label object, width of label , font size of text, such like...

[self setdynamicheightoflabel:lblname withlblwidth:passwidth andfontsize:19]; 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -