self.searchbar.isAccessibilityElement=YES;
self.searchbar.accessibilityLabel=@"searchbar";
self.searchbar.accessibilityHint=@"searchbar";
self.searchbar.accessibilityElementsHidden=NO;
The above code i have added for a UISearchbar outlet in ViewDidLoad.Unfortunately accessibility labels are not getting displayed.I used the above code for all UIelements and works fine except for UISearchbar.Do we have to use UIAccessibilityContainer for UISearchbar?
You need to tell iOS which accessibility trait best characterizes the object. In this case you want:
self.searchbar.accessibilityTraits = UIAccessibilityTraitSearchField;
You may also want to have a look Apple's UIAccessibilityTraits documentation.