Using this for UIAlertView
- (void) alertStatus:(NSString *)msg :(NSString *)title :(int) tag
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
message:msg
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
alertView.tag = tag;
[alertView show];
}
But now UIAlertView is deprecated. change my code
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* MyAlert = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:MyAlert];
[self presentViewController:alertController animated:YES completion:nil];
Here you can pass the value of this tag
alertView.tag = tag;
Help how to pass tag value to UIAlertController. Thanks in advance.
source
share