Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request- update slider by Textfields Input (vice versa) #77

Closed
2 tasks
naveedmcs opened this issue Jul 11, 2019 · 1 comment
Closed
2 tasks

Comments

@naveedmcs
Copy link

naveedmcs commented Jul 11, 2019

New Issue Checklist

  • update slider by Textfields Input
  • update textfields by update slider

Issue Description

insert min and max value in textField to update range slide, and if slide value is changed textfields should also updated

  • iOS 14
  • Swift 5
@naveedmcs
Copy link
Author

this feature has been already added

  • using by slider delegate

  • update slider e.g
    in viewDidLoad
    minRange.addTarget(self, action: #selector(minRangeTextFieldChanged), for: .editingChanged)
    // function Defination
    @objc func minRangeTextFieldChanged(){

      if minRange.text?.count == 0 {
        
        slider.selectedMinValue = 0
        slider.setNeedsLayout()
    
      }
    
      guard let minNumber = NumberFormatter().number(from:  minRange.text ?? "0") else {return }
      guard let maxNumber = NumberFormatter().number(from: maxRange.text ?? "0") else {return }
      let minFloat = CGFloat(truncating: minNumber)
      let maxFloat = CGFloat(truncating: maxNumber)
      if minFloat < maxFloat {
          slider.selectedMinValue = minFloat
          slider.setNeedsLayout()
      }
    

    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant