Is it possible to completely disable dynamic type for an app? If not, is it possible to disable the dynamic type feature for UITableViewCell classes?
Disable dynamic type
Well, your app can pretty much ignore dynamic type. If the standard table view cells don't ignore it then you can simply build cells that duplicate the standard ones but which igore dynamic type.
I just verified the following:
- With iOS <= 9.3 my app was not affected from a user changing the text size in accessibility
- With iOS >= 10.0 I get a mixture that looks ugly because my own cells do not support it but for example the standard UITableView header does support it (that's just one example)
I think there should be a way to disable that feature completely for an entire app, otherwise you have to either write all the UI elements manually or you have to support it throughout the whole app.
iOS 10 added a protocol UIContentSizeCategoryAdjusting with a single method adjustsFontForContentSizeCategory. I know this affects UITextView and UILabel. Not sure what other classes might be affected. The comments in that file say that this property will only work if the font property is one of the preferred fonts. You could set that value to false on all the relevant labels and text views. It might also be possible to set that with the appearance methods. Something like this might work (not tested by me):
UILabel.appearance().adjustsFontForContentSizeCategory = false
Thanks for that answer! I was experimenting with adjustsFontForContentSizeCategory already but it doesn't have any effect unfortunately. For example on UITableViewCell textLabel and detailTextLabel setting adjustsFontForContentSizeCategory to NO doesn't prevent the labels from changing their font according to the system settings.
Derive a custom application class and override preferredContentSizeCategory
.