Post

Replies

Boosts

Views

Activity

Reply to TextField Action After Done
Okay I see what you mean but I have an issue implementing it for two textfields. It says my text value is nil and it does not move the slider. func textFieldShouldReturn(_ textField: UITextField) -> Bool {   textField.resignFirstResponder()   let text = textField.text   let textNum = Int(text!)   /*when you enter a value it will affect, the slider and squareOne width value will change and squareTwo width will change */   if widthPer.text == text {     squareOneWidth.constant = CGFloat(textNum!) * 2     slider.value = Float(textNum!)     calPercentage()     calPercentageTwo()     /*when you enter a value it will affect, the sliderHeight and squareOne height will change and squareTwo height will change */   } else if heightPer.text == text {     calPercentage()     calPercentageTwo()   }   print("\(text)")   return true }
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’20