File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1010@implementation RNCSlider
1111{
1212 float _unclippedValue;
13+ UITapGestureRecognizer * tapGesturer;
14+ }
15+
16+ - (instancetype )initWithFrame : (CGRect)frame
17+ {
18+ self = [super initWithFrame: frame];
19+ if (self) {
20+ tapGesturer = [[UITapGestureRecognizer alloc ] initWithTarget: self action: @selector (tapHandler: )];
21+ [tapGesturer setNumberOfTapsRequired: 1 ];
22+ [self addGestureRecognizer: tapGesturer];
23+ }
24+ return self;
25+ }
26+ - (void )tapHandler : (UITapGestureRecognizer *)gesture {
27+ CGPoint touchPoint = [gesture locationInView: self ];
28+ [self setValue: touchPoint.x / self .bounds.size.width animated: YES ];
1329}
1430
1531- (void )setValue : (float )value
@@ -99,4 +115,8 @@ - (void)setInverted:(BOOL)inverted
99115 }
100116}
101117
118+ - (BOOL )beginTrackingWithTouch : (UITouch *)touch withEvent : (UIEvent *)event {
119+ return YES ;
120+ }
121+
102122@end
You can’t perform that action at this time.
0 commit comments