简体   繁体   中英

How to use a UIAlert to open a NIB or UIView

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

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

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

    switch (buttonIndex) {

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


        case 2: {

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

        }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM