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

Hello I have integrated your library but i am facing an issue if is give a default value then when view loads the scale scrolls way ahead. #2

Open
dsoftware763 opened this issue Jan 10, 2020 · 1 comment

Comments

@dsoftware763
Copy link

override func viewWillAppear(_ animated: Bool) {
if UserDefaul.getBool(key: UserDefaultKeys.heightSelected) == true {
let height = UserDefaul.getInteger(key: UserDefaultKeys.heightCm)
heighPicker.setDefaultHeight(CGFloat(height), unit: .CM)
// heighPicker.reloadInputViews()
self.contBtnEnabled(btn: self.contBtn)
}else {
heighPicker.reloadInputViews()
self.contBtnDisabled(btn: self.contBtn)
}
}

func setupTYHeightPicker() {
    heighPicker = TYHeightPicker()
    heighPicker.translatesAutoresizingMaskIntoConstraints = false
    heighPicker.delegate = self
    self.heightView.addSubview(heighPicker)
    
    heighPicker.leftAnchor.constraint(equalTo: self.heightView.leftAnchor).isActive = true
    heighPicker.rightAnchor.constraint(equalTo: self.heightView.rightAnchor).isActive = true
    heighPicker.centerYAnchor.constraint(equalTo: self.heightView.centerYAnchor).isActive = true
    heighPicker.heightAnchor.constraint(equalToConstant: 145).isActive = true
}
@tudorpopa39
Copy link

DispatchQueue just solved my problem

DispatchQueue.main.async {
    heighPicker.setDefaultHeight(170, unit: .CM)
}

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

2 participants