我正在使用RangeSeekSlider在我的应用中显示滑块。在正常情况下,即对于所有LTR语言(从左到右),它都能正常工作。但是,当使用阿拉伯语这样的语言时,要求滑块从右到左(即与普通语言相反)开始,对我来说不起作用。
为供您参考,我尝试了以下代码,但对我而言无效,
@IBOutlet weak var sliderAmount: RangeSeekSlider!
override func viewDidLoad() {
super.viewDidLoad()
if AppUtils.checkIfArabic() == true{
sliderAmount.semanticContentAttribute = .forceRightToLeft
}else{
self.sliderAmount.semanticContentAttribute = .forceLeftToRight
}
// Do any additional setup after loading the view.
}
以下是使用以下代码设置的普通滑块的屏幕截图
//MARK:- Setup Slider View
func setupSliderView(){
sliderAmount.disableRange = true
sliderAmount.enableStep = true
sliderAmount.step = 500
sliderAmount.delegate = self
sliderAmount.minValue = 500.0
lblAmt.text = "500"
sliderAmount.maxValue = 25000.0
sliderAmount.handleImage = UIImage(named: "ic_SliderHandler")
sliderAmount.handleDiameter = 35.0
sliderAmount.lineHeight = 7.0
sliderAmount.hideLabels = true
sliderAmount.tintColor = UIColor(displayP3Red: 235/255, green: 235/255, blue: 235/255, alpha: 1.0)
sliderAmount.colorBetweenHandles = UIColor(displayP3Red: 135/255, green: 102/255, blue: 123/255, alpha: 1.0)
}
当前输出:
TIA。