Monday, 15 August 2011

ios - Adjust UIButton label font ,to screen size -



ios - Adjust UIButton label font ,to screen size -

i have buttons created in code, , size in % screen size, alter width , height proportionally screen .

the thing remains in same size font size .

i know there way set minimum font size :

cat.titlelabel.font=[uifont fontwithname:@"gill sans" size:12]; cat.titlelabel.numberoflines=1; cat.titlelabel.minimumfontsize=2; //not

but, lastly row here ,minimum size ,is deprecated ,and xcode not allowed utilize it.

so , seek set fit width :

cat.titlelabel.adjustsfontsizetofitwidth=yes;

which results in different font sizes buttons same width , height , can see 10 buttons in same frame,and different text length different font size .i guess width same text width , not button frame.width .

is there other solution fit frame ?

you can seek using cat.titlelabel.minimumscalefactor set minimum font size. takes in multiplier value against current font size.

ios objective-c

No comments:

Post a Comment