Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Present formsheet modal ViewController using horizontal flip

I currently show a modal UIViewController in the formSheet style that was presented with the coverVertical animation. I am trying to present another modal UIViewController from it, using currentContext for the presentation style and flipHorizontal for the animation style. It does work, but there is a solid white white background behind the flip as it occurs. Any advice on how to successfully present another formsheet modal UIViewController using the flipHorizontal style from a pre-existing modal UIViewController in the formSheet style would be appreciated please! Thanks

Code:

// Loading of first modalVC
- (void)showModalVC {

    Modal1VC *modal1VC = [[Modal1VC alloc] init];
    modal1VC.modalPresentationStyle = UIModalPresentationFormSheet;
    modal1VC.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:modal1VC animated:YES];
    [modal1VC release];

    modal1VC.view.superview.bounds = CGRectMake(0, 0, 400, 400);
}

// Loading of second modalVC in Modal1VC
- (void)buttonTapped:(id)sender {

    UIViewController *modal2VC = [[UIViewController alloc] init];
    modal2VC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    modal2VC.modalPresentationStyle = UIModalPresentationCurrentContext;
    modal2VC.view.backgroundColor = [UIColor greenColor];
    [self presentModalViewController:modal2VC animated:YES];
    [modal2VC release];

    modal2VC.view.superview.bounds = CGRectMake(0, 0, 400, 400);
}
like image 382
CastToInteger Avatar asked Sep 12 '11 12:09

CastToInteger


1 Answers

UIViewController *presentingViewController = //allocate your VC
[modalViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
UIViewController *modalViewController = //your modal VC
[presentingViewController presentModalViewController:modalViewController animated:YES];

This is all the code you need ;)

like image 170
rajomato Avatar answered Oct 09 '22 03:10

rajomato