if function "Savedata" is called, I add new button into [UIbutton] and I add new element into array [[Double]]. I want, for every button on index [i] to display data in array [[Double]] on index [i]. How shall I do the loop?
@IBAction func Savedata(_ sender: Any) {
subjectsznamky.insert(arrayx, at: 0) //subjectsznamky is the [[Double]] array
var button : UIButton
button = UIButton(type: .system) as UIButton
button.frame = CGRect(x:5, y: 20, width: 100.0, height: 30)
button.setTitle(ourname, for: .normal)
self.view.addSubview(button)
buttons.append(button)
for i in buttons.indices {
buttons[i].frame.origin.y += 30
buttons[i].addTarget // here I need to create the function, that every button on index [i] displays data in subjectsznamky on index[i]
}
Thank you.