如何将accessibilityLabel添加到UIAlertView按钮? 
  
  
 
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Announcement" 
                                                message: @"message!"
                                               delegate: nil    
                                      cancelButtonTitle: @"cancelButton"  
                                      otherButtonTitles: @"otherButton"]; 
[alert show];
解决方法
 唯一可以做到这一点的方法是在UIAlertView子视图中找到UIButtons: 
  
  
 
        for (id button in self.alertView.subviews){
    if ([button isKindOfClass:[UIButton class]]){
        ((UIButton *)button).accessibilityLabel = @"your custom text";
    }
} 
 但是这是唯一的方法,因为没有公共API来访问这些UIButton,这是因为Apple不希望您访问它们.访问UIAlertView类的内部视图是Apple不允许的,并且很可能会在App Store审核过程中拒绝您的应用.
如果您确实需要具有自定义accessibilityLabel的UIButtons,您应该考虑设计自定义警报视图而不是使用Apple UIAlertView类.