UIAlertView chiudere l'App
-
18-09-2019 - |
Domanda
nel mio progetto la mia prima applicazione cerca di connettersi a internet, ma ora devo verificare se ci sia una connessione disponibile! così ho fatto un caso, all'interno di un altro UIAlertView nella parte else!
ma come posso chiudere l'intera applicazione su un clic sul seguente pulsante?
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Keine Internetverbindung" message:@"Es konnte keine Verbindung zu www.sip.de hergestellt werden!" delegate:nil cancelButtonTitle:@"Schliessen" otherButtonTitles:nil];
grazie a tutti per l'aiuto in anticipo
saluta Marco
Soluzione
.h file
@interface UntitledViewController: UIViewController
file .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);
}
Spero che questo aiuti
Altri suggerimenti
UIalertViewConfigure:
UIAlertView * applicationExitAlert = [[UIAlertView alloc] initWithTitle: @ messaggio "Exit": @ "si vuoi anche uscite questa applicazione" delegato: auto cancelButtonTitle: @ "Annulla" otherButtonTitles: @ "OK", nil];
[applicationExitAlert spettacolo]; [Rilascio applicationExitAlert];
UIAlertViewDelegate:
- (void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) buttonIndex { if (buttonIndex == 1) { exit (0); } }
Spero che il suo lavoro