Setting accessibility identifier programmatically on UIBarButtonItem

后端 未结 4 1812
深忆病人
深忆病人 2021-02-12 08:25

The accessibility identifier is a developer generated ID for GUI objects, which can be used for automation tests.

A UIBarButtonItem does not implement

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-12 08:47

    As of iOS 5 you can do it like this:

    UIBarButtonItem *btn = [[UIBarButtonItem alloc] init...;
    btn.accessibilityLabel = @"Label";
    

提交回复
热议问题