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 10
10
@implementation RNCSlider
11
11
{
12
12
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 ];
13
29
}
14
30
15
31
- (void )setValue : (float )value
@@ -99,4 +115,8 @@ - (void)setInverted:(BOOL)inverted
99
115
}
100
116
}
101
117
118
+ - (BOOL )beginTrackingWithTouch : (UITouch *)touch withEvent : (UIEvent *)event {
119
+ return YES ;
120
+ }
121
+
102
122
@end
You can’t perform that action at this time.
0 commit comments