I'm switching away from preferredContentSizeChanged to use adjustsFontForContentSizeCategory for my UILabel, UITextView, and UITextField classes. It works for UILabel, but not for UITextView and UITextField. It only works if I call setNeedsDisplay inside preferredContentSizeChanged.
What am I missing?
You also need to set the font used by the UITextfield to be scalable:
    textField.adjustsFontForContentSizeCategory = true
    textField.font = .preferredFont(forTextStyle: .body)
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