It is my first post and when I was editing, updating the post it happened like this
So welcome to the forum.
For editing properly, you have to: paste code with Paste and Match Style (avoid insertion of a lot of blank lines)
remove useless blank lines
Use the code formatter (<>)
Here is the result
@interface UISegmentedControl (CustomSegmentControl)
@end
@implementation UISegmentedControl (CustomSegmentControl)
(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
		NSInteger current = self.selectedSegmentIndex;
		[super touchesBegan:touches withEvent:event];
		if (current == self.selectedSegmentIndex)
				[self sendActionsForControlEvents:UIControlEventValueChanged];
		[self.nextResponder touchesBegan:touches withEvent:event];
}
(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
		[self setSelectedSegmentIndex:self.selectedSegmentIndex];
		[super touchesEnded:touches withEvent:event];
		[self.nextResponder touchesEnded:touches withEvent:event];
}
@end
extension of UISegmentedControl for touches events in iOS 12 is working but in iOS 13 and in iOS 14 is not working, Why? * What did you expect ? What do you get ?
One remark: in tutorials from Apple, super is called as the first statement of the override func
// Implemented in your custom subclass (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
		[super touchesBegan:touches withEvent:event]; if ([touches count] != 1) {
			 self.state = UIGestureRecognizerStateFailed;
			 return;
		 }
}
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: