UIKit Custom Symbol Accessible Font Size

Hello everyone,

I am developing an application using UIKit and am attempting to use a custom svg symbol in a button, however I am able to adjust the font size statically but am unable to allow the user to adjust the font size based on the user's accessibility font size settings. I have the following code for the image configuration:

let imageConfiguration = UIImage.SymbolConfiguration(textStyle: .body)
button.setImage(UIImage(named: "image", in: Bundle.main, with: imageConfiguration)!, for: .normal)

Any help would be greatly appreciated!

Cheers!

Hello, please try configuring your UIImage further before assigning it to the button. You should set this property on UIImage to true, adjustsImageSizeForAccessibilityContentSizeCategory

https://developer.apple.com/documentation/uikit/uiaccessibilitycontentsizecategoryimageadjusting/2890929-adjustsimagesizeforaccessibility?ref=blog.kevin-hirsch.com

UIKit Custom Symbol Accessible Font Size
 
 
Q