up vote
0
down vote
favorite
I am programmatically creating a UIBarButtonItem and setting its accessibility identifier and label. Here is the code I am using for it.
_rightBarButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40.0f, 40.0f)]; buttonImage = [[UIImage imageNamed:@"bt_send_.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0.0f, 0, 0.0f)]; [_rightBarButton setBackgroundImage:buttonImage forState:UIControlStateNormal]; [_rightBarButton addTarget:self action:@selector(sendQuickNote:) forControlEvents:UIControlEventTouchUpInside]; //Accessibility Identifier for Send Button _rightBarButton.isAccessibilityElement = YES; _rightBarButton.accessibilityIdentifier = @"Send Note"; _rightBarButton.accessibilityLabel = @"Send Note"; [_rightBarButton setTitle:@"Send Note" forState:UIControlStateNormal];
self.sendButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_rightBarButton]; self.sendButtonItem.enabled = NO;
//Accessibility Identifier for Send Button self.sendButtonItem.isAccessibilityElement = YES; self.sendButtonItem.accessibilityIdentifier = @"Send Note"; self.sendButtonItem.accessibilityLabel = @"Send Note"; [self.sendButtonItem setTitle:@"Send Note"];
[self.navigationItem addRightBarButtonItem:self.sendButtonItem];
But the accessibility Identifiers are not available in Appium inspector. What am i doing wrong here?
Thanks.