Saturday, December 29, 2012

[iOS] Before Flipside View get input value from pop-up pane

Before game start, UIAlertView will pop-up to get course name, then pass the value to next page for display and start game on Flipside view.

- (IBAction)showInfo:(id)sender
{
    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Welcome!!" message:@"Enter your course name:"
                                                    delegate:self cancelButtonTitle:@"Continue" otherButtonTitles:nil];
    alert.alertViewStyle = UIAlertViewStylePlainTextInput;
    UITextField * alertTextField = [alert textFieldAtIndex:0];
    alertTextField.keyboardType = UIKeyboardTypeDefault;
    alertTextField.placeholder = @"Enter your course name";
    [alert show];
}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    NSString *buttonTitle=[alertView buttonTitleAtIndex:buttonIndex];
    if ([buttonTitle isEqualToString:@"Continue"]) {
        UITextField *textField = [alertView textFieldAtIndex:0];
        FlipsideViewController *controller = [[FlipsideViewController alloc]
                                              initWithNibName:@"FlipsideViewController" bundle:nil];
        controller.delegate = self;
        controller.courseName = textField.text;
        controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentViewController:controller animated:YES completion:nil];
    }
}


1 comment:

Anonymous said...

LeoVegas Casino - Play at GoldenRace Casino in Gold Coast
Try 10cric login the best of LeoVegas 10bet Casino. Get a 100% leovegas welcome bonus of up to ₹1500 to play at LeoVegas Casino.