Avatar ·

Como alterar a fonte do UIButton em Swift: 3 maneiras testadas

Olá a todos! Sou novo em Swift e desenvolvimento iOS. Encontrei um problema: não consigo alterar a fonte do UIButton. Crio o botão pelo Interface Builder, conecto o IBOutlet e tento definir a fonte programaticamente. Aqui está meu código: ```swift import UIKit class ViewController: UIViewController { @IBOutlet weak var myButton: UIButton! override func viewDidLoad() { super.viewDidLoad() // Tento alterar a fonte myButton.titleLabel?.font = UIFont(name: "Helvetica-Bold", size: 20) // Ou assim: myButton.titleLabel?.font = UIFont.systemFont(ofSize: 16) } } ``` Mas a fonte não muda! Já tentei diferentes abordagens: defini a fonte no Interface Builder, alterei no código antes e depois de definir o título. Às vezes