Despedir a PresentedViewController mientras está presente desde UipOpoverController
-
26-12-2019 - |
Pregunta
PresentedViewController presente de Popoverview, este es el código que estoy usando
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);
Controlador abierto bien, cuando intento cerrar el controlador, recibo esta advertencia
"ADVERTENCIA: ¡Intento de descartar desde View Controller mientras una presentación o despido está en progreso!"
Después de eso, si hago clic en cualquier botón, la aplicación se bloqueará.
Este el código que estoy usando para descartar la vista
[self dismissViewControllerAnimated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:^{
[(UINavigationController *)self.presentingViewController popToRootViewControllerAnimated:YES];
}];
if (![self.presentedViewController isBeingDismissed])
[self dismissViewControllerAnimated:YES completion:nil];
Cuando intento descartar la vista de Popover obteniendo la misma advertencia
Solución
en la primera línea correcta por debajo de la línea.
SearchPropertyVC *SearchPropertyVC *centerViewController = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];
SearchPropertyVC *searchPropertyVC = (SearchPropertyVC *)[board instantiateViewControllerWithIdentifier:@"vcSearchPropertyID"];
Elija cualquier estilo de presentación,
ConDetVC.modalPresentationStyle = UIModalPresentationPageSheet;
ConDetVC.modalPresentationStyle = UIModalPresentationFormSheet;
Hoja de página o hoja de formulario.
y mientras intenta presentar, use el objeto de control del controlador que desea presentar.
[self presentViewController:ConDetVC animated:YES completion:nil];
y cuando se descarta, solo escribe,
[self dismissViewControllerAnimated:YES completion:^{
// write you code here
}];
Otros consejos
Esto te ayudará:
[self.presentedViewController dismissViewControllerAnimated: YES completion:^(void) {
[self presentViewController:myController animated:YES completion:nil];
}];