Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- /// Will send value changed even if the selected index is selected again
- class ReselectSegmentedControl: UISegmentedControl {
- override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
- let currentIndex = selectedSegmentIndex
- super.touchesEnded(touches, with: event)
- if currentIndex == selectedSegmentIndex {
- sendActions(for: UIControlEvents.valueChanged)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement