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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -