File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,14 @@ - (void)tapHandler:(UITapGestureRecognizer *)gesture {
77
77
78
78
CGPoint touchPoint = [gesture locationInView: slider];
79
79
float rangeWidth = slider.maximumValue - slider.minimumValue ;
80
- float sliderPercent = touchPoint.x / slider.bounds .size .width ;
80
+
81
+ float sliderPercent;
82
+ if ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute: slider.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft) {
83
+ sliderPercent = 1.0 - (touchPoint.x / slider.bounds .size .width );
84
+ } else {
85
+ sliderPercent = touchPoint.x / slider.bounds .size .width ;
86
+ }
87
+
81
88
slider.lastValue = slider.value ;
82
89
float value = slider.minimumValue + (rangeWidth * sliderPercent);
83
90
Original file line number Diff line number Diff line change @@ -57,7 +57,14 @@ - (void)tapHandler:(UITapGestureRecognizer *)gesture {
57
57
58
58
CGPoint touchPoint = [gesture locationInView: slider];
59
59
float rangeWidth = slider.maximumValue - slider.minimumValue ;
60
- float sliderPercent = touchPoint.x / slider.bounds .size .width ;
60
+
61
+ float sliderPercent;
62
+ if ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute: slider.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft) {
63
+ sliderPercent = 1.0 - (touchPoint.x / slider.bounds .size .width );
64
+ } else {
65
+ sliderPercent = touchPoint.x / slider.bounds .size .width ;
66
+ }
67
+
61
68
slider.lastValue = slider.value ;
62
69
float value = slider.minimumValue + (rangeWidth * sliderPercent);
63
70
You can’t perform that action at this time.
0 commit comments