How to get the System font in an iOS app?
Asked Answered
A

2

9

I am using Xamarin Studio to develop an iOS iPad app. I need to assign the System font name to a variable in the code behind on one of the pages.

How do I get whatever the System font is programmatically?

Aspasia answered 8/10, 2013 at 9:15 Comment(0)
F
24

NOTE: Before somebody thinks he has to change this answer: This is answering a question about Xamarin.iOS and not ObjectiveC. The API really uses uppercase properties and method names.

Create a system UIFont and read its properties:

var font = UIFont.SystemFontOfSize(10);
string familyName = font.FamilyName;
string fontName = font.Name;

See also Apple's reference for UIFont.

Frediafredie answered 8/10, 2013 at 9:42 Comment(0)
P
5

Starting with iOS7, you have a richer way of getting the font, using the new UIFont properties.

For details see:

http://tirania.org/monomac/archive/2013/Sep-25.html

Pepillo answered 12/10, 2013 at 15:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.