UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

How to get the up-to-date UIButton size when system font size changes

Forums > iOS

I have a UIButton whose title is using dynamic font size. I want to know the button's new width immediately when I change the system font size in Settings app. button.frame.width seems not yet updated in the didChangeNotification handler. How can I/is it possible to know the updated width of the button using the new font size? Thanks!


Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.