Availability Large text from settings

When I try to implement a user-selected text font from the settings available in my application, I cannot get the user-selected text size in my application. the code is similar to

let contentSize = UIApplication.sharedApplication().preferredContentSizeCategory

preferredContentSizeCategory always returns the same font as UICTContentSizeCategoryL , even after changing settings / accessibility

+4
source share
1 answer

add the following code to your viewDidLoad to get notified when the font size is changed with the settings available.

[[NSNotificationCenter defaultCenter]
                              addObserver:self
                                 selector:@selector(preferredContentSizeChanged:)
                                     name:UIContentSizeCategoryDidChangeNotification
                                   object:nil];

Then add the following method:

- (void)preferredContentSizeChanged:(NSNotification *)notification {
    self.textView.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
}

.

. , , , , . , ; . , preferredFontForTextStyle: .

EDIT:

: fooobar.com/questions/69279/...

[UIApplication sharedApplication].preferredContentSizeCategory;

+8

All Articles