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 {
7777
7878 CGPoint touchPoint = [gesture locationInView: slider];
7979 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+
8188 slider.lastValue = slider.value ;
8289 float value = slider.minimumValue + (rangeWidth * sliderPercent);
8390
Original file line number Diff line number Diff line change @@ -57,7 +57,14 @@ - (void)tapHandler:(UITapGestureRecognizer *)gesture {
5757
5858 CGPoint touchPoint = [gesture locationInView: slider];
5959 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+
6168 slider.lastValue = slider.value ;
6269 float value = slider.minimumValue + (rangeWidth * sliderPercent);
6370
You can’t perform that action at this time.
0 commit comments