Swift3: Live UiLabel update on user input

前端 未结 4 1442
面向向阳花
面向向阳花 2021-01-07 13:45

I\'ve searched everywhere and can\'t seem to find a clear answer on updating a label in real-time.

How do i go about updating a UILabel (real-time) with

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-07 14:33

    You are update your label in textField shouldChangeCharactersInRange Delegate method :

       func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
    
          // Update Your label here......
    
         YourLabel.text = textField.text 
         return true
     }
    

提交回复
热议问题