我正在以编程方式创建 UIBarButtonItem 并设置其可访问性标识符和标签。这是我正在使用的代码。
_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];
但是可访问性标识符在 Appium 检查器中不可用。我在这里做错了什么?
谢谢。