UIAlertView закрыть приложение - PullRequest
1 голос
/ 08 марта 2010

в моем проекте мое приложение сначала пытается подключиться к Интернету, но теперь я должен проверить, есть ли доступное подключение! поэтому я сделал if, else внутри UIAlertView в else-части!

но как я могу закрыть все приложение одним нажатием на следующую кнопку?

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

Спасибо всем за помощь заранее

приветствует Марко

Ответы [ 2 ]

1 голос
/ 08 марта 2010

.h файл

@ interface UntitledViewController: UIViewController { }

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

надеюсь, это поможет

0 голосов
/ 20 января 2011

UIalertViewConfigure:

UIAlertView * applicationExitAlert = [[UIAlertView alloc] initWithTitle: @ «Выход» сообщение: @ «Вы хотите выйти из этого приложения» делегат: self cancelButtonTitle: @ «Cancel» otherButtonTitles: @ "OK", nil];

[applicationExitAlert show]; [applicationExitAlert release];

UIAlertViewDelegate:

  • (void) alertView: (UIAlertView *) alertView clickedButtonAtIndex: (NSInteger) buttonIndex { if (buttonIndex == 1) { Выход (0); } } * +1010 *

Я надеюсь, что его работа

...