我想在每次点击时更改文字(或背景或动画或其他内容),最好的方法是什么?
function orderarrayByReferencearrayIds(array $referencearray, array $arrayToSort) {
// get an array with the id order of the reference array
$idOrder = array_column($referencearray, 'id');
usort($arrayToSort, function (array $a, array $b) use ($idOrder) {
// get the index in reference sort order of each element
$aIndex = array_search($a['id'], $idOrder);
$bIndex = array_search($b['id'], $idOrder);
return $aIndex - $bIndex;
});
return $arrayToSort;
}
答案 0 :(得分:0)
创建大量和一个计数参数
var count = 0
var texts = ["Thanks for grabiN.", "ComeOn you can do iT"]
UIView.animate(withDuration: 1.5) {
self.button.frame.origin.y = 30
self.button.frame.size.height = 200
self.button.frame.size.width = 130
self.button.backgroundColor = .yellow
self.text.textColor = .white
self.text.frame.origin.y += 110
self.background.backgroundColor = .black
let index = self.count % self.texts.count
self.text.text = self.texts[index]
self.count+=1
}