I am trying to change the label text with the code below:
class ViewController: UIViewController {
@IBAction func buttontobepressed(_sender: Any)
{
displayMessage.text?="button pressed"
}
@IBOutlet weak var displayMessage: UILabel!
when I try running it, it gives me an exception:
$ ibc++abi.dylib: terminating with uncaught exception of type NSException$
Full log:
2017-06-10 12:07:14.672 blabby[4334:781388] -[blabby.ViewController buttontobepressed:]: unrecognized selector sent to instance 0x7bf54fe0 2017-06-10 12:07:14.679 blabby[4334:781388] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[blabby.ViewController buttontobepressed:]: unrecognized selector sent to instance 0x7bf54fe0' libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) **
?after thetextproperty write it likedisplayMessage.text = "button pressed"- Nirav D_andsenderlikebuttontobepressed(_ sender: Any)- Nirav D