I am trying to use UIAlertController for several purposes. It has two buttons, cancel and OK. I would like to add it to the method and click the button so that I can simply check the user's response and act on it.
Now I can not return the value inside the block . So how can I do this?
Thanks.
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Atenção!", "Atenção!") message:NSLocalizedString(@"Você não finalizou a sua série. Se sair desta tela, irá zerar o cronômetro.", "") preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *cancelar = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancelar", "Cancelar") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { [alertController dismissViewControllerAnimated:YES completion:nil];
UPDATE: real use
When the user clicks the back button , he is called by the status check method. If the condition is met, a warning is displayed, and the user must decide whether to leave the screen or not. Therefore, it would be great to return an answer to IBAction back button .
Note. The whole idea is that other methods, in addition to the back button , also display a warning and receive a response from the user.
Jorge source share