ios - Which of the following will set the font of UISegmentedControl? -
uifont font = [uifont boldsystemfontofsize: 12.0f]; nsdictionary attributes = [nsdictionary dictionarywithobject: font forkey: uitextattributefont]; [segmentedcontrol settitletextattributes: attributes forstate: uicontrolstatenormal];
[[uisegmentedcontrol appearance] settitletextattributes:[nsdictionary dictionarywithobjectsandkeys:[uifont fontwithname:@"stheitisc-medium" size:13.0], uitextattributefont, nil] forstate:uicontrolstatenormal];
segmentedcontrol.transform = cgaffinetransformmakescale(.6f, .6f);
none of these.
uifont font = [uifont boldsystemfontofsize: 12.0f]; nsdictionary attributes = [nsdictionary dictionarywithobject: font forkey: uitextattributefont]; [segmentedcontrol settitletextattributes: attributes forstate: uicontrolstatenormal];
the above code change font 1 particular segmentcontrol whereas below code change font segmentcontrol in app.
[[uisegmentedcontrol appearance] settitletextattributes:[nsdictionary dictionarywithobjectsandkeys:[uifont fontwithname:@"stheitisc-medium" size:13.0], uitextattributefont, nil] forstate:uicontrolstatenormal];
and code segmentedcontrol.transform = cgaffinetransformmakescale(.6f, .6f);
scale down segmentcontrol
note:
just replace deprecated uitextattributefont
nsfontattributename
work without warning.
Comments
Post a Comment