UIAlertView Button Accessibility
-
21-12-2019 - |
Question
[UIAlertView alertViewWithTitle:@"" message:@"Submit successfully!" cancelBlock:^(NSInteger buttonIndex) {
} dismissBlock:nil cancelButtonTitle:@"OK" otherButtonsTitles:nil, nil];
This is the UIAlertView
declaration. However, I desire to UI test cancelButton
.
[tester tapViewWithAccessibilityLabel:@"cancelButton"];
How should I add accessibility to that cancelButton?
Solution
You should be able to dismiss the alert by triggering a tap of the cancel button. You can identify the cancel button by its label, which is "OK" in your case.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow