Search code examples
iphoneobjective-ccocoa-touchipadios4

How can I use UIModalPresentationFormSheet with NavigationController in iPad?


I want to use UIModalPresentationFormSheet in my app. But i'm using navigation controller. So when i writes following code it is not responding me. What should i do ?

    [self.navigationController pushViewController:controller animated:YES];

Solution

  • Check with the below sample working code.

    MyModalViewController *targetController = [[[MyModalViewController alloc] init] autorelease]; 
    
    targetController.modalPresentationStyle = UIModalPresentationFormSheet;
    targetController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; //transition shouldn't matter 
    [self presentModalViewController:targetController animated:YES];
    
    targetController.view.superview.frame = CGRectMake(0, 0, 200, 200);//it's important to do this after 
    
    presentModalViewController targetController.view.superview.center = self.view.center;
    

    Taken from -->

    How to resize a UIModalPresentationFormSheet?