我有一個簡單的視圖,用「showAlert」方法鏈接了一個按鈕。當我點擊這個按鈕時,它顯示一個UIAlertView。如何使用ios 7禁用UIAlertView按鈕?
之前,與iOS 6,我用下面的代碼來禁用一個UIAlertView中按鈕:
- (IBAction)showAlert:(id)sender
{
myAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:@"Retour" otherButtonTitles:@"Button1", @"Button2", @"Button3", @"Button4", nil];
[myAlert show];
for(UIView *aView in myAlert.subviews)
{
if ([[[aView class] description] isEqualToString:@"UIAlertButton"])
{
UIButton *aButton = (UIButton *)aView;
if ([aButton.titleLabel.text isEqualToString:@"Button2"])
aButton.enabled = NO;
}
}
}
現在,與iOS 7,這是行不通的,爲什麼?
pfff ...爲什麼會出現這種迴歸?感謝您快速回答安東尼奧。 –
煩人,我知道! –
是的,討厭...感謝您的幫助。 –