我有一个IBOutletCollection of UIImageView
现在我需要在里面访问imges,我怎么能做到呢?
我只需通过以下代码访问第一个和列表
myCollection.first?.image
myCollection.last?.image我需要访问其他图像
发布于 2016-09-27 05:21:57
IBOutletCollection是一个数组,因此要访问它的元素,我们可以使用下标,就像从普通数组访问元素一样。
因此,要访问它的元素:
myCollection[0].image //or myCollection.first?.image
myCollection[1].image
myCollection[2].image
....
myCollection.last?.imagehttps://stackoverflow.com/questions/39716312
复制相似问题