Reputation: 1
I'm trying to make a VAT converter which gets the VAT percentage of a slider and applies it to a value taken from a UITextField, then outputs it to another text field. My button push action looks like this:
@IBaction func Calculate(sender: AnyObject){
var curentval = Int(Slider.value) // Get the vat % from the slider
var sum = Sum.text.toInt() //
var VAT = sum! * curentval/100 // this is what I'm trying to output in a text field that is called VAT
Upvotes: 0
Views: 749
Reputation: 23883
You can use like this one
@IBOutlet weak var txtVat:UITextField!
@IBaction func Calculate(sender: AnyObject){
var curentval = Int(Slider.value) // Get the vat % from the slider
var sum = Sum.text.toInt()
var finalVal = sum! * curentval/100
txtVat.text = UInt8(finalVal)
}
Upvotes: 1