Reputation: 10068
I'm new to Swift and is trying out the beginner's project of building a calculator. The image below shows what stage I am up to.
However, I have just noticed that every single one of my operator buttons (except ÷) are not connected to the @IBAction func operate(sender: UIButton){}
. How to connect those buttons to the @IBAction func operate(sender: UIButton){}
?
Upvotes: 1
Views: 5016
Reputation: 507
In Swift 3, you'd like to change the @IBAction
's argument from default (_ sender: Any)
to (_ sender: UIButton)
or (_ sender: AnyObject)
, but manually.
It might work.
Upvotes: 0
Reputation: 5188
You can check what outlets your buttons are connected to by right clicking on them. To connect a button to an action, hold down control while clicking and dragging from the button to the action you want to attach it to.
Upvotes: 2