Xcode Language Question | Pickerview

I am currently using xcode to design an app. I am trying to implement the "pickerview" into my app. How would I assign text to each picker "tab", and how to assign each tab to a certain array of names. Randomly picking a name depending on what "tab" the pickerview is on when a separate button is clicked. Displaying the generated name to a label (from an array).

var counter = 0
class ViewController: UIViewController {
  @IBOutlet weak var label: UILabel!
  @IBOutlet weak var pickerView: UIPickerView!
  
  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view.
  }

  @IBAction func randomWord(_ sender: Any) {
     
    let array = ["I hit it off the toe of the club", "I hit the wrong club", "I haven't played in weeks", "I think im getting old", "Stupid, Fly", "It's this new putter", "Did you see that? This bug just landed on the ball", "Its just too hot to be playing golf" , "I grabbed the wrong club", "Golf is about technique, not playing well" , "I got no sleep last night" , "I haven't played in forever" , "My wife forgot to use the fabric softener again" ,"The group ahead is playing slow, going against my rhythm"]

    let array2 = ["Just give up", " Too many excuses", "You're terrible" , "Go Practice"]
    counter += 1
    if (counter > 9) {
      label.text = array2.randomElement()
      print(counter)
    }
    else {
      label.text = array.randomElement()
      print(counter)
    }
     
     
     
     
  }
   
}
Answered by rzkhilman in 679109022

Do you mean you want to custom each label inside of the pickerview?

Accepted Answer

Do you mean you want to custom each label inside of the pickerview?

Xcode Language Question | Pickerview
 
 
Q