0
class ViewController: UIViewController {
    @IBOutlet weak var btn: UIButton!
    override func viewDidLoad() {
        // Error on following line: "Thread 1: EXC_BAD_INSTRUCTION"
        btn.titleLabel?.numberOfLines = 1;
        btn.titleLabel?.adjustsFontSizeToFitWidth = true
        btn.titleLabel?.lineBreakMode = .byClipping
        super.viewDidLoad()
    }
}

What should I do with this? Even my simulator won't open while this error occurs.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Old York
  • 73
  • 1
  • 9
  • Your button outlet isn't connected. – rmaddy Apr 08 '17 at 16:20
  • You cannot set the UIButton to set number of lines , UILabel have this feature. I guess you can just set the wrap mode for teh UIButton and hence resolve the error. – codelover Apr 08 '17 at 16:53
  • @VickyDhas The code is trying to set `numberOfLines` on a `UILabel`. That's not the issue. – rmaddy Apr 08 '17 at 19:13

0 Answers0