otherButtonTitles в UIAlertView

Мне было просто любопытно на предмет того, как я могу присоединить некоторую другую задачу к otherButtonTitle UIAlertView. Кнопка отмены автоматически вынимает Вас из приложения, но если я хочу присоединить другую задачу с otherButtonTitle, что я должен сделать?

Спасибо,

9
задан Ashutosh 23 July 2010 в 04:39
поделиться

1 ответ

Делегат UIAlertView «didDismissWithButtonIndex» вызывается каждый раз, когда вы нажимаете любую кнопку.

Попробуйте следующее:

UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Message" 
                                                message:messageString
                                               delegate:self 
                                      cancelButtonTitle:@"Back"
                                      otherButtonTitles:@"Reply",@"Delete",nil];
[alert show];
[alert release];


- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 
{
  if (buttonIndex == 1)
  {
    NSLog(@"Reply");
    UIAlertView *myalert = [[UIAlertView alloc] initWithTitle:@"Button Clicked" message:@"U clicked Reply " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

    [myalert show];
    [myalert release];  
  }

  if (buttonIndex == 2)
  {
    NSLog(@"Delete");
    UIAlertView *myalert = [[UIAlertView alloc] initWithTitle:@"Button Clicked" message:@"U clicked Delete " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

    [myalert show];
    [myalert release];  
  }
}
22
ответ дан 4 December 2019 в 09:35
поделиться
Другие вопросы по тегам:

Похожие вопросы: