[help plz] Using alerts to: close app and push view?

Discussion in 'iOS Development' started by abotsch31, Jun 24, 2009.

  1. abotsch31

    abotsch31 Banned

    Joined:
    Feb 9, 2009
    Messages:
    31
    Likes Received:
    0
    I am developing an app, and am almost finished, but on the last page of the application there is an alert that is going to have 2 buttons on it:

    -1 button that completely exits out of the app
    -the other button that reverts back to the home view

    (I know it would be easier not to have a pop-up, but for what I am doing, it has to be that way...)

    ...So this is where I am at:

    Code:
    -(IBAction)buttonPressed:(id)sender
    {
    	UIAlertView *alertView = [[UIAlertView alloc]
    							  initWithTitle:@"Random text"
    							  message:@"More random text"
    							  delegate:self
    							  cancelButtonTitle:nil
    							  otherButtonTitles:@"Restart", @"Close", nil];
    	[alertView show];
    	[alertView release];
    }


    I have looked into finding my answer and have found this

    [[UIApplication sharedApplication] terminateWithSuccess];

    Now all I need to do is implement that into the alert...

    Any help would be stupendous!

    Thanks

    -Abotsch31
  2. abotsch31

    abotsch31 Banned

    Joined:
    Feb 9, 2009
    Messages:
    31
    Likes Received:
    0
    Thanks for the spam...
  3. Steaps

    Steaps New Member

    Joined:
    Oct 24, 2007
    Messages:
    5,074
    Likes Received:
    41
    Device:
    iPod touch
    Code:
    - (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    	if(buttonIndex == 0) {
    		//Cancel
    
    	} else if (buttonIndex == 1) {
    		//OK
    		[[UIApplication sharedApplication] terminateWithSuccess];
    	}
    }
    
  4. abotsch31

    abotsch31 Banned

    Joined:
    Feb 9, 2009
    Messages:
    31
    Likes Received:
    0
    nev'a mind, I got it, thanks for your help

Share This Page