0
Good,
I’m making an app where I’ll measure users' BMI. I created the layout but in the code I’m having problems.
I have a button that when sliding changes the value of height or weight.
var w:Float = 75
alturachg(_ sender:UISlider) {
h = sender.value
lblAltura.text = NSString(Format: " %2.f m", h) }
Before closing }
forces me to have the String to make no mistake.
Do you want to convert from Nsstring to String type? If that’s it just do the following:
NSString(Format: " %2.f m", h) as String
– Leonardo Cesar Teixeira
lblAltura.text = String(format: "%.2f m", sender.value)
– Leo Dabus