Re: Help with iOS 15-style UIButton?


Rick Aurbach
 
Edited

Hi, Alex.

The work-around was to force the button width to be "expectedWidth" (which is the width of the [unwrapped] text + image padding + image width + 8 points of slop (to account for button margins). If you notice, I override draw() to always make this adjustment just before calling super.draw(). The 8 its of margin was determined by experiment.

The comment about "mirroring above bounds code" just means that I was (historically) using different logic to adjust button size in the pre-15 case, and that I should probably change that code to use the same logic as the 15+ version.

Hope this helps.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.