Question

in my project my app first tries to connect to the internet, but now i have to check if there is an connection available! so i made an if, else within an UIAlertView in the else part!

but how can i close the whole app on a click on the following button?

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

thank you all for helping beforehand

greets Marco

Was it helpful?

Solution

.h file

@interface UntitledViewController : UIViewController < UIAlertViewDelegate > { }

.m file


- (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);
}

hope this helps

OTHER TIPS

UIalertViewConfigure:

UIAlertView *applicationExitAlert = [[UIAlertView alloc] initWithTitle:@"Exit" message:@"Are You wanto to exits this App" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil];

[applicationExitAlert show]; [applicationExitAlert release];

UIAlertViewDelegate:

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

i hope its work

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top