Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import UIKit
  2.  
  3. /// Will send value changed even if the selected index is selected again
  4. class ReselectSegmentedControl: UISegmentedControl {
  5.  
  6. override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
  7. let currentIndex = selectedSegmentIndex
  8. super.touchesEnded(touches, with: event)
  9.  
  10. if currentIndex == selectedSegmentIndex {
  11. sendActions(for: UIControlEvents.valueChanged)
  12. }
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement