简体   繁体   中英

2 UIButtons with different text lenght same font size

I have 2 buttons with the same width and height, also y-Achse centered. They differ only from text length. With iPhone 5, 6 and 6+ they look very well. But with iPhone 4s one button will do not more have the same front size as the other one and it is text will be not more centered. My question is if there is a method to adopt the font size of the 2 buttons so they will take together the same font with small value of font size of one button.

If I understand correctly, you want to use the same font size for both buttons, even when one of them has to reduce the size for the text to fit it.

Use something like this to reduce the size of the font on each button, until an appropriate size is found for both buttons. Take the minimum of the sizes you found, and use it on both buttons.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM