UIStepper in Swift 5?
UIStepper control which is used to change number value plus or minus. It's contain + and - symbols. it's increase and decrease the value. This tutorial with Xcode 10.2.1 and Swift 5.
Create a New Single View App :
AppName and Bundle Identifier:
Add Element
UILabel and UIStepper in storyboard. UIStepper for +/- and UILabel for display stepper value.
Add IBOutlet and Action for Stepper and UILabel.
Set Props for UIStepper :
Code :
Create a New Single View App :
AppName and Bundle Identifier:
Add Element
UILabel and UIStepper in storyboard. UIStepper for +/- and UILabel for display stepper value.
Add IBOutlet and Action for Stepper and UILabel.
Set Props for UIStepper :
Code :
//
// ViewController.swift
// UIStepperDemo
//
// Created by Kirit Modi on 16/08/19.
// Copyright © 2019 Kirit Modi. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var stepper: UIStepper!
@IBOutlet weak var lbl_Stepper: UILabel!
@IBAction func onChangeStepperValue(_ sender: UIStepper) {
self.lbl_Stepper.text = String((sender as UIStepper).value);
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
Output :
Demo:
Thanks.
UIStepper in Swift 5?
Reviewed by KIRIT MODI
on
23:05:00
Rating:
No comments: