C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Name: I chose the names simpleStepper and simpleLabel just to keep things simple for this tutorial.
ActionTriggered: Right-click on the Stepper and drag the "Action Triggered" circle to the ViewController to create a method.
Here: We add code to the actionTriggered func. We read in the value and set the text to a string that includes the value.
StringExample UIStepper usage: Swift
//
// ViewController.swift
// ExampleTimeF
//
// ...
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var simpleStepper: UIStepper!
@IBOutlet weak var simpleLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func actionTriggered(sender: AnyObject) {
// Get value of UIStepper.
// ... This is a double.
let value = simpleStepper.value
// Set text of label to the value of the stepper.
simpleLabel.text = "Value: " + String(value)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}