Replacement for titleEdgeInsets and imageEdgeInsets in UIButton For UIButtonConfiguration

The attached documentation for both of these properties

API_DEPRECATED("This property is ignored when using UIButtonConfiguration"

but what if we wanted to add spacing to the title or image? Just to confirm, is the equivalent refactor to use titlePadding and imagePadding in UIButtonConfiguration?

The appropriate replacements are a bit contextual:

  • If you want to change the padding from the bounds of the button to its content, thats contentInsets
  • If you want to change the spacing between an image and title content thats imagePadding
  • If you want to change the spacing between a title and subtitle thats titlePadding

A diagram of this is in the WWDC 2021 Meet the UIKit button system here: https://developer.apple.com/wwdc21/10064?time=425

Replacement for titleEdgeInsets and imageEdgeInsets in UIButton For UIButtonConfiguration
 
 
Q