Help with adjustsFontSizeToFitWidth?

Asked

Viewed 28 times

0

When using adjustsFontSizeToFitWidth in the second outlet I get error.

Does anyone know how to solve?

Note: The second view controller is the first in the same class!

import UIKit

class ViewController: UIViewController {
    @IBOutlet weak var botaoIniciar: UIButton!
    @IBOutlet weak var botaoBrasil: UIButton!
    override func viewDidLoad() {    
        super.viewDidLoad()
        botaoIniciar.titleLabel?.adjustsFontSizeToFitWidth = true
        botaoIniciar.titleLabel?.baselineAdjustment = .alignCenters
        botaoBrasil.titleLabel?.adjustsFontSizeToFitWidth = true
        botaoBrasil.titleLabel?.baselineAdjustment = .alignCenters
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
}
  • Places the error being generated.

  • thread1: EXC_BAD_INTRUCTON (code=EXC+I386_INVOP, subcode=0x0)

  • but only happens pro because the second viewcontroller be in the class of that document Swift , the first boot that is in the first viewcontroller is running normal ! baseline tbm does not wheel ! will I have to use some delegate method

  • 1

    I believe the error lies in the storyboard

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.