tags:

views:

359

answers:

1

here is my code so far I can get a URL to work but i want to load a nib from this Alert tab

    - (IBAction)aboutAction { // The action called when the about button is clicked.
UIAlertView * aboutView = [[UIAlertView alloc] initWithTitle:@"Alert:" // Create a new UIAlertView named aboutScreen, and allocate it. Set the title to "About" 
              message:@"MESSAGE GOES HERE" 
             delegate:self 
             cancelButtonTitle:@"Got It Thanks!"  
             otherButtonTitles:@"Donate Now", nil]; 

        [aboutView show]; // Show the UIAlertView on the screen.
        [aboutView release]; // Release the UIAlertView from the memory.
    }


    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
        if(buttonIndex == 1) { //Not sure what to do here.
        }

    }
+1  A: 

-(void) alertView:(UIAlertView *) alertview clickedButtonAtIndex:(NSInteger)buttonIndex {

switch (buttonIndex) {

    case 1: {
        Accidenthelpercall *help = [[Accidenthelpercall alloc] initWithNibName:nil bundle:nil];
        [self presentModalViewController:help animated:NO];
    }


    case 2: {

        Accidentdamagecar *damagecar = [[Accidentdamagecar alloc] initWithNibName:nil bundle:nil];
        [self presentModalViewController:damagecar animated:NO];

    }

}

That code will leak -- you need to either autorelease those controllers when you create them or add a release call after calling presentModalViewController on them.
Dennis Munsie