Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift: UIBarButtonItem setting accessibility identifier programmatically

I'm trying to set accessibility identifier. I look into this sample:

myBarButton.accessibilityIdentifier = @"I am a test button!";

But I don't get the accessibilityIdentifier in swift.

Any of you knows how can I set the accessibilityIdentifier in swift?

like image 460
user2924482 Avatar asked Nov 27 '22 04:11

user2924482


1 Answers

UIBarButtonItem does not implement UIAccessibilityIdentification, so setting accessibilityIdentifier doesn't work.

Instead try

myBarButton.accessibilityLabel = "I am a test button!"
like image 171
alpennec Avatar answered Dec 07 '22 00:12

alpennec