1
我要寻找一个优雅方式,通过数组迭代和它的每一个值分配给一个或多个五UILabel
小号如何通过多个UILabels迭代
此代码说明了什么,我试图做(虽然它是很长,重复)
if touches.count >= 1 {
positionTouch1LBL.text = String(describing: touches[0].location(in: view))
} else {
positionTouch1LBL.text = "0.0/0.0"
}
if touches.count >= 2 {
positionTouch2LBL.text = String(describing: touches[1].location(in: view))
} else {
positionTouch2LBL.text = "0.0/0.0"
}
if touches.count >= 3 {
positionTouch3LBL.text = String(describing: touches[2].location(in: view))
} else {
positionTouch3LBL.text = "0.0/0.0"
}
if touches.count >= 4 {
positionTouch4LBL.text = String(describing: touches[3].location(in: view))
} else {
positionTouch4LBL.text = "0.0/0.0"
}
if touches.count >= 5 {
positionTouch5LBL.text = String(describing: touches[4].location(in: view))
} else {
positionTouch5LBL.text = "0.0/0.0"
}