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
Post a Comment