简体   繁体   中英

How to increase Font Size in button Pragmatically (swift3)

I would like the user to have the ability to make the text larger.

I have figured out how to increase a button overall size but the text remains the same.

button.frame =  CGRect(x: 100, y: 400, width: 100, height: 50)

How to increase Font Size in button Pragmatically in swift3?

Use titleLabel, like this:

let button = UIButton()
button.titleLabel?.font = UIFont.systemFont(ofSize: 30)

You can use UIFont in a lot of ways, check it's constructor!

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