我以编程方式创建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检查器中没有可访问性标识符。我在这做错了什么?
感谢。