UIAlert View-for status yes / no

my application needs an msg alert, and using the yes button, click another msg alert that will resolve the final action. I used - (void) alertView: (UIAlertView *) alertView didDismissWithButtonIndex: (NSInteger) buttonIndex this method.

Please help me.

-2
source share
2 answers

Do what @Adrian Pirvulescu said, but do it before the warning alert.tag = 1;, and then when - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndexdo is called :

if (alertView.tag == 1) {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"2nd Alert" 
    message:@"My message" delegate:self cancelButtonTitle:@"Cancel"
    otherButtonTitles:@"OK", nil];
    alert.tag = 2;
    [alert show];
    [alert release];
}
else if (alertView.tag == 2) {
    [self CallSomeMethod];
}
else {
    //do what ever you want here
}
+1
source

Check it out http://www.timeister.com/2010/06/objc-show-alert-iphone/

// open a alert with an OK and cancel button
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" 
        message:@"My message" delegate:self cancelButtonTitle:@"Cancel"
        otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
0
source

Source: https://habr.com/ru/post/1752947/


All Articles