I have a label with a minus and plus button beside it. What I want it to do is increment the value of the label by 1 if the plus button is tapped, and subtract 1 if the minus button is tapped.
So, + and - are buttons ?
Just create:
- IBOulet for the label : myLabel
@IBOutlet weak var myLabel: UILabel!
- IBActions for the buttons, such as:
@IBAction func plus() {
guard let presentValue = Int(myLabel!.text) else { return }
let newValue = presentValue + 1
myLabel!.text = String(newValue)
}
idem for minus.