My goal is to create a slotmachine, in which the rows are spinning and one by one, they need to stop spinning, one by one. However, to make it look nice, the rows needs to spin atleast like 3 seconds. I think PickerView is the best option for this, since I have no idea on how to make this work in a different way.
When this is my code:
self.slotMachine.selectRow(99, inComponent: 1, animated: true)
The PickerView will go to row 99, but in 1 second. How can I control this second (and extend the selecting row process)? One condition is it should look nice and feel like you are playing a slot machine. I tried this:
UIView.animate(withDuration: 3.0, delay: 0, animations: { () -> Void in
self.slotMachine.selectRow(99, inComponent: 1, animated: true)
}, completion: nil )
But this did not work.
Thanks.
You could use a timer and select the cells one by one like this:
Swift version:
OC version: