Answers for "create label array swift"

0

uilabel.text from array string

import UIKit

class ViewController: UIViewController {

var arrays = ["A", "b", "C", "D", "E", "F"]
var currentIndex = 0

@IBOutlet weak var ChangeText: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()
    ChangeText.text = arrays[currentIndex]
}

@IBAction func Button() {
    currentIndex++
    if (currentIndex == arrays.count {
        currentIndex = 0
    }

    ChangeText.text = arrays[currentIndex]
}
}
Posted by: Guest on December-27-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language