After creation of a list of Label created with this func:
func addElongationlabel() {
let elongationLabel = UITextView(frame: CGRect(x: 100, y: ordinata, width: 90, height: 35))
elongationLabel.textAlignment = NSTextAlignment.center
elongationLabel.tag = ordinata
elongationLabel.textColor = UIColor.blue
elongationLabel.backgroundColor = UIColor.red
view.addSubview(elongationLabel)
}
I'm obtaining a list of label using this cycle of For:
for i in 1...Int(numberOfDiesText.text!)!{
ordinata = 220 + 50*i
addElongationlabel()
}//end of for
Now I want to assign to my Labels a value calculated. I'm trying with this code but it is not working:
for i in 1...Int(numberOfDiesText.text!)!{
ordinata = 220 + 50*i
if let eloLabel = (self.view.viewWithTag(ordinata)as? UILabel){
// here I think I have to insert the correct command
self.view.viewWithTag(ordinata) = eloLabel // this is not working...of course
}
}//end of for
Thank you to help me!