ios - How do I change the font of a UISegmentedControl in swift without changing the font size? -


i want change font of uisegmentedcontrol without changing font size.

this code but, obviously, in case change font size too:

let attr = nsdictionary(object: uifont(name: "avenir", size: 12.0)!, forkey: nsfontattributename) segmentedcontrol.settitletextattributes(attr [nsobject : anyobject] , forstate: .normal) 

how can solve this?

try following code, not proper way, don't have other option, should go via wat

int fontsize; (id segment in [segmentedcontrol subviews])  {     (id label in [segment subviews])      {         if ([label iskindofclass:[uilabel class]])         {           fontsize = label.font.pointsize;           // here got label, use font size here           break;         }     }    } 

now got fontsize, can use change font face


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -