iOS 7: What is UIBarButtonItem's default font?

ma11hew28 picture ma11hew28 · Sep 22, 2013 · Viewed 8.8k times · Source

What is the default font of the title of a UIBarButtonItem with a style of UIBarButtonItemStyleDone?

The following just returns nil:

[doneBarButtonItem titleTextAttributesForState:UIControlStateNormal]

Answer

ma11hew28 picture ma11hew28 · Sep 22, 2013

[UIFont boldSystemFontOfSize:17]

Note: I confirmed this by doing:

UIFont *font = [UIFont boldSystemFontOfSize:17];
[doneBarButtonItem setTitleTextAttributes:@{NSFontAttributeName: font}
                                 forState:UIControlStateNormal];

And then, I took screenshots of the before & after and compared them. They were identical.