Skip to content

Instantly share code, notes, and snippets.

@myell0w
Last active January 2, 2016 14:09
Show Gist options
  • Save myell0w/8315322 to your computer and use it in GitHub Desktop.
Save myell0w/8315322 to your computer and use it in GitHub Desktop.
Respect the accessibility setting "Bold Text" on iOS7, when implementing Dynamic Type with a custom font.
BOOL MTDIsBoldTextEnabled(void) {
static BOOL boldTextEnabled = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// Hack that checks if the "bold text" flag in the accessibility settings is enabled
UIFont *font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
boldTextEnabled = [font.fontName rangeOfString:@"MediumP4"].location != NSNotFound;
});
return boldTextEnabled;
}
@myell0w
Copy link
Author

myell0w commented Jan 8, 2014

still running iOS 7.0.4, up until then it restarts iOS and the app gets killed. Didn't test it on iOS 7.1 Beta though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment