Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. extension UIPickerView {
  2.  
  3. func slowSelectRow(_ row: Int, inComponent component: Int = 0) {
  4. let currentSelectedRow = selectedRow(inComponent: component)
  5.  
  6. guard currentSelectedRow != row else {
  7. return
  8. }
  9.  
  10. let diff = (currentSelectedRow > row) ? -1 : 1
  11. let newRow = currentSelectedRow + diff
  12. selectRow(newRow, inComponent: component, animated: true)
  13.  
  14. DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
  15. self.slowSelectRow(row, inComponent: component)
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement