【发布时间】:2018-06-30 03:14:38
【问题描述】:
有货币汇率数组,在 inputTextField 中输入金额后,我想更新此数组中的所有项目,以这种货币的金额并将其放在 tableView 中,尝试使用循环执行此操作,但这不正确因为这是每个循环都放在表中的解决方案
inputTextField 是文本字段的名称
receivedRates:[Double] = [1.1,1.6,2.0,1.3] // just example of the rates
for i in receivedRates {
let newValue = Double(i)*Double(Int(inputTextField.text!)!)
currentAmount.append(newValue)
receivedRates = currentAmount
}
如何在没有循环的情况下更新这个数组,或者这个循环是否有其他解决方案?
【问题讨论】:
标签: ios arrays swift insert-update items