Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIContentSizeCategoryDidChangeNotification not working on simulator iOS 9.3, does work on device

Tags:

ios

iphone

I have an observer for UIContentSizeCategoryDidChangeNotification that gets triggerd when a user changes the font-size under settings -> accessibility.

   NSNotificationCenter.defaultCenter().addObserver(self, selector: "preferredContentSizeChanged:", name: UIContentSizeCategoryDidChangeNotification, object: nil)

I've never experienced any problems with this before, but now i am having problems with it on the iphone simulator iOS 9.3. It works however on a real device with iOS 9.3.

The simulator returns

bogus value for UIPreferredContentSizeCategoryName: (null)

Has anyone else experienced the same problem?

like image 627
Collinizer Avatar asked Mar 24 '16 15:03

Collinizer


People also ask

How do you put videos on Iphone simulator?

It's very simple you just drag any . MOV file to your simulator. Now it will be opened in Safari browser.

How can I make iOS simulator run faster?

Close unused applications to free system resources such as cpu & memory. make sure "slow animations" is not selected in the simulator debug menu. Short cut for this is ⌘T simulator -> Debug -> slow animations.


1 Answers

It seems like a bug in iOS, I have written this:

print(UIApplication.sharedApplication().preferredContentSizeCategory)

And I found, when the app is running on a real device with iOS 9.3, the console info could be UICTContentSizeCategoryXXXL、UICTContentSizeCategoryXXL、UICTContentSizeCategoryXL、UICTContentSizeCategoryL、UICTContentSizeCategoryM、UICTContentSizeCategoryS、UICTContentSizeCategoryXS

But when the app in running on iOS simulator with iOS 9.3, the console info is always UICTContentSizeCategoryL, no matter what font size I chose in settings.

like image 178
Kaiyuan Xu Avatar answered Sep 26 '22 00:09

Kaiyuan Xu