Question

PresentedViewController present from popoverview, this is the code I'm using

SearchPropertyVC *SearchPropertyVC *centerViewController = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];
UINavigationController *ConDetVC = [[UINavigationController alloc] initWithRootViewController:centerViewController];
ConDetVC.modalPresentationStyle = UIModalPresentationPageSheet;
ConDetVC.modalPresentationStyle = UIModalPresentationFormSheet;
ConDetVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentViewController:ConDetVC animated:YES completion:nil];
ConDetVC.view.superview.bounds = CGRectMake(0, 0, 700, 670);

controller open fine, when I was try to close the controller I'm getting this Warning

"Warning: Attempt to dismiss from view controller while a presentation or dismiss is in progress!"

after that if I click any button the app will crashed.

this the code I'm using to dismiss the view

[self dismissViewControllerAnimated:YES completion:nil];

[self dismissViewControllerAnimated:YES completion:^{
             [(UINavigationController *)self.presentingViewController popToRootViewControllerAnimated:YES];
         }];

if (![self.presentedViewController isBeingDismissed])
            [self dismissViewControllerAnimated:YES completion:nil];

when I try to dismiss the popover view itself getting the same warning

Was it helpful?

Solution

At very first correct below line.

 SearchPropertyVC *SearchPropertyVC *centerViewController = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];

 SearchPropertyVC *searchPropertyVC = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];

choose any one presentation style,

 ConDetVC.modalPresentationStyle = UIModalPresentationPageSheet;
 ConDetVC.modalPresentationStyle = UIModalPresentationFormSheet;

either page sheet or form sheet.

And while you try to present, use object of view controller you want to present.

 [self presentViewController:ConDetVC animated:YES completion:nil]; 

And when it being dismissed, just write,

 [self dismissViewControllerAnimated:YES completion:^{
         // write you code here
     }];

OTHER TIPS

This will help you :

 [self.presentedViewController dismissViewControllerAnimated: YES completion:^(void) {
             [self presentViewController:myController animated:YES completion:nil];
    }];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top