【问题标题】:HOW TO CALCULATE EMI per MONTH USING SLIDER [closed]如何使用滑块每月计算 EMI [关闭]
【发布时间】:2022-11-18 19:13:05
【问题描述】:

LIKE this image i need to get emi amount using slider

     let numberOfPayments = Double(lblTenureAmount.text!) ?? .zero
                let interestRate = Double(lblInterestAmount.text!) ?? .zero
                let rate = interestRate / 100 / 12
                let answer = loanAmount * rate / (1 - pow(1 + rate, -numberOfPayments))
                lblLoanEMI.text = Formatter.currency.string(for: answer)

我尝试过使用 Ui 按钮操作获取数据,但实际上我需要使用滑块

【问题讨论】:

标签: swift


【解决方案1】:

您可以使用滑块视图的以下操作

@IBAction func sliderValueChanged(_ sender: UISlider) {
    let currentValue = Int(sender.value)
        
    label.text = "(currentValue)"
}

你可以参考这篇不错的文章https://www.ioscreator.com/tutorials/slider-ios-tutorial#:~:text=Enter%20Swift%20as%20Language%20and%20choose%20Next.%20Go,100%20and%20change%20the%20current%20value%20to%200

【讨论】:

    猜你喜欢
    • 2020-07-15
    • 2021-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多