iphone - Can't get UITextField to autoshrink text -
i have uitextfield
on table view cell, , when it's text becomes long font size decrease. want make clear talking uitextfield
, not uilabel
or uitextview
. reason because have seen question pop several times , answers based on uilabel
instead of uitextfield
. example, asked "i can't uitextfield
autoshrink" , answer "make sure it's numberoflines
set 1
". best of knowledge, uitextfield
not have property , single line control.
i have tried:
- in ib setting font system 14.0,
minfontsize
7 , checking "adjust fit" box - in code in
tableview:cellforrowatindexpath:
ptcell.name.font = [uifont systemfontofsize: 14.0]; ptcell.name.adjustsfontsizetofitwidth = yes; ptcell.name.minimumfontsize = 7.0;
but neither of these have worked. mean instead of text shrinking truncates tail.
does know missing? presumably should work because have seen other questions complaining doing when user not want to.
i had same problem. uitextfield stoped shrinking text when long, instead resized , grew outside 'bounds'.
the solution helped me set width constraint on given uitextfield. after did not grew anymore, instead text inside got smaller intended. (of course have set minfontsize , check "adjust fit" box in storyboard.)
i know it's kind of late, if else find question via google did...it might help.
Comments
Post a Comment