UIAlertView fechar a App
-
18-09-2019 - |
Pergunta
no meu projeto meu aplicativo primeiro tenta se conectar à internet, mas agora eu tenho que verificar se há uma conexão disponível! assim que eu fiz um if, else dentro de um UIAlertView na parte mais!
Mas como posso fechar o aplicativo inteiro em um clique no botão seguinte?
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Keine Internetverbindung" message:@"Es konnte keine Verbindung zu www.sip.de hergestellt werden!" delegate:nil cancelButtonTitle:@"Schliessen" otherButtonTitles:nil];
Obrigado a todos pela ajuda de antemão
cumprimenta Marco
Solução
arquivo .h
@ interface UntitledViewController: UIViewController
arquivo .m
- (void)viewDidLoad {
[super viewDidLoad];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Keine Internetverbindung" message:@"Es konnte keine Verbindung zu www.sip.de hergestellt werden!" delegate:nil cancelButtonTitle:@"Schliessen" otherButtonTitles:nil];
[alert setDelegate:self];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
exit(0);
}
espero que isso ajude
Outras dicas
UIalertViewConfigure:
UIAlertView * applicationExitAlert = [[UIAlertView alloc] initWithTitle: @ mensagem "Exit": @ "Você wanto às saídas deste App" delegado: auto cancelButtonTitle: @ "Cancelar" otherButtonTitles: @ "OK", nil];
[mostrar applicationExitAlert]; [Liberação applicationExitAlert];
UIAlertViewDelegate:
- (void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) buttonIndex { se (buttonIndex == 1) { saída (0); } }
Eu espero seu trabalho