简体   繁体   中英

Accessibility: UISlider's UIControlEventValueChanged is not posted when slider.value is set in Voice-over mode

I am having a UISlider in my parent view. I want to honor the Voice-over gestures for slider movement and thus, i have implemented accessibilityIncrement and accessibilityDecrement methods as below:

- (void)accessibilityIncrement
{
     float finalValue = self.value;
    finalValue = (finalValue + 1);
    if (finalValue > self.maximumValue)
        finalValue = self.maximumValue;
    self.value = finalValue;    
}

- (void)accessibilityDecrement
{
    float finalValue = self.value;
    finalValue = (finalValue - 1);
    if (finalValue < self.minimumValue)
        finalValue = self.minimumValue;
    self.value = finalValue;

}

The issue is when I set the value of the slider (using self.value = finalValue), the selector for UIControlEventValueChanged event does not get called. Is this a Bug?

Thanks!

对于带有VoiceOver的UISlider推荐的解决方案包括在代码中使用委托 ,使用已经使用的incrementdecrement方法根据旋钮位置调整滑块值。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM