我正在嘗試更改UIAlertView按鈕上的輔助功能標籤。我看到這個代碼在線:在UIAlertView中更改按鈕的輔助功能標籤 - iOS
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test"
message:@"Message"
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
// In a standard UIAlertView there are 2 UILabels and some buttons
// The UILabel with the message is always the 2nd object in the array
NSArray *subviews = alert.subviews;
UILabel *messageLabel = [subviews objectAtIndex:1];
[messageLabel setAccessibilityLabel:@"Some other text"];
但它只返回UILabels的子視圖,而不是按鈕(在我自己的情況下)。我該怎麼做呢?
謝謝。如果需要自定義的alertview,將不再實現此功能 –