2010-03-08 6 views
1

dans mon projet mon application essaie d'abord de se connecter à Internet, mais maintenant je dois vérifier s'il y a une connexion disponible! donc j'ai fait un if, sinon dans un UIAlertView dans la partie else! Mais comment puis-je fermer toute l'application en cliquant sur le bouton suivant?UIAlertView fermer l'App

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Keine Internetverbindung" message:@"Es konnte keine Verbindung zu www.sip.de hergestellt werden!" delegate:nil cancelButtonTitle:@"Schliessen" otherButtonTitles:nil]; 

vous remercie tous pour aider à l'avance

Marco salue

Répondre

1

.h

@interface UntitledViewController: UIViewController < UIAlertViewDelegate> {}

fichier .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); 
} 

espérons que cette aide

+1

Son ne fonctionne pas dans iOS5. Toute autre méthode possible pour quitter l'application. –

+0

Je peux confirmer que @NewXcoder est correct. Quelle autre méthode pourrait fonctionner? –

+0

Avez-vous essayé [NSApp terminate: self]? – Lolo

0

UIalertViewConfigure:

UIAlertView * applicationExitAlert = [[UIAlertView alloc] initWithTitle: @ message "Quitter": @ "êtes-vous WANTO à Quitte cette application" délégué: auto cancelButtonTitle: @ "Annuler" otherButtonTitles: @ "OK", néant];

[applicationExitAlert show]; [version d'applicationExitAlert];

UIAlertViewDelegate:

  • (void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) buttonIndex { if (buttonIndex == 1) { sortie (0); }}

J'espère que ses travaux