问题
Protocol:
UIPickerViewAccessibilityDelegate
Method:
-pickerView:accessibilityLabelForComponent:
Problem:
Apple Documentation says
- (NSString *)pickerView:(UIPickerView *)pickerView
accessibilityLabelForComponent:(NSInteger)component
But the pickerView which I get inside this method is NOT a UIPickerView*, but is a UIAccessibilityPickerElement, and hence using pickerView.tag inside this method crashes.
I have 2 pickerviews in my view controller and I need to access the tag to identify them.
Question:
How can I provide accessibilityLabel for components of both pickerViews in this method?
回答1:
Maybe this help.
I have a very similar problem with a custom component. I have a pickerView in this component. My was "weak" that's why I couldn't access to tag property.
I had to define a new property to identify each picker.
来源:https://stackoverflow.com/questions/28445598/unable-to-get-pickerview-tag-in-pickerviewaccessibilitylabelforcomponent-meth