Inside settings->general->text size, after changing the text size, I'd have to exit my own app to have the sizes applied to
[UIFont preferredFontForTextStyle:..]
Is there a delegate or notification to notify my app to re-apply the new sizes?
Update: I tried the following but interestingly, the font size will apply after I BG and launch the app TWICE.
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fromBg:) name:UIApplicationDidBecomeActiveNotification object:nil]; } -(void) fromBg:(NSNotification *)noti{ self.headline1.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; self.subHeadline.font = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline]; self.body.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; self.footnote.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; self.caption1.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption1]; self.caption2.font = [UIFont preferredFontForTextStyle:UIFontTextStyleCaption2]; // [self.view layoutIfNeeded]; }
If the font changes, it's because the app you have open changed it, not you. But that doesn't mean you can't edit the text at all. Every iPhone lets you change the font size, making it either bigger or smaller. This is great for users with impaired vision, or with magnified screens.
The Dynamic Type feature allows users to choose the size of textual content displayed on the screen. It helps users who need larger text for better readability. It also accomodates those who can read smaller text, allowing more information to appear on the screen.
Dynamic Type is a feature that enables the app's content to scale based on the user's preferred content size. The preferred content size can be found in Settings -> Accessibility -> Display & Text Size -> Larger Text.
You listen for the Size Change Notification on UIContentSizeCategory.
Swift 3.0: NSNotification.Name.UIContentSizeCategoryDidChange
Swift 4.0 or later: UIContentSizeCategory.didChangeNotification
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With