I'm having a Xamarin.IOs project. I need to use dynamic type fonts in my application.
I have followed this tutorial in doing so. The tutorial is in in swift I guess. And for the code segment,
label.Font = UIFontMetrics(forTextStyle: .title1).ScaledFont(for: customFont)
in the tutorial, the equivalent Xamarin.IOs C# code is,
label.Font = UIFontMetrics.GetMetrics(textStyle: <string_value>).GetScaledFont(customFont);
But what are the values can I use for <string_value>
of textStyle
?
I have tried,
"title 1"
"title1"
".title1"
".title 1"
"UIFontTextStyleTitle1"
"PreferredTitle1"
but non helped.
What string values does UIFontMetrics.GetMetrics()
accept?
There are two ways to do this,
Way 1:
The text style's string values can be taken from the
TextStyle
property ofUIFontDescriptor
text style properties,Way 2:
The text style's string values can be taken from the
GetConstant()
extension method ofUIFontTextStyle
text style properties,One of these would be much better than entering string values directly