I have a UISlider with 50 values. How to move different UIView, when value in slider changes?
I've tried this:
if oldValue < Int(sender.value) {
viewToMove.center.y = viewToMove.center.y - heightOfDay
print(viewToMove.center.y)
oldValue = Int(sender.value)
print(oldValue)
} else if oldValue > Int(sender.value) {
viewToMove.center.y = viewToMove.center.y + heightOfDay
print(viewToMove.center.y)
oldValue = Int(sender.value)
print(oldValue)
}
Slider's value changing but viewToMove.center.y isn't.
The most probably is the viewToMove
layout added with auto layout.
If so, then you need to update the constant of the NSLayoutConstraint which holds the centerY
position of the viewToMove