ios - XCode - Making ordered names imageView array? -


i made array of type uiimageview, , button add new imageview array want name each new image order image1, image2, image3 .. etc

var array = [uiimageview]()  @ibaction func addimage(_ sender: any) let newimage = uiimageview() self.view.addsubview(newimage) array.append(newimage) 

instead using name can work tag

newimage.tag = array.count  array.append(newimage) 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -