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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -