I believe this means that your view is already presenting something and it cannot present another view on the top of it.
Warning while dismissing and presenting FullScreen ModalViewController
-
08-10-2022 - |
Question
I have SplitViewController
project. In the detail's pane (right side), in the method -viewDidAppear
, I have this code:
login.modalPresentationStyle = UIModalPresentationFullScreen;
login.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
In the "login" ViewController
I have a button that when is clicked, goes to this method:
-(void)registerEvent{
NSLog(@"registerEvent");
[self dismissViewControllerAnimated:YES completion:^{
[_delegate dismissLogin];
}];
}
And in my delegate ViewController
(the detailViewController
) method, I have this code:
-(void)dismissLogin{
ViewControllerRegister * registerForm = [ViewControllerRegister new];
[registerForm setDelegate:self];
registerForm.modalPresentationStyle = UIModalPresentationFullScreen;
registerForm.modalTransitionStyle = transition;
[self presentViewController:registerForm animated:YES completion:nil];
}
The problem is, if I change the modal presentation style to UIModalPresentationFormSheet
, the compiler gives me NO warning and the registerForm ViewController
is presented. But with UIModalPresentationFullScreen
, the compiler gives me this warning:
Warning: Attempt to present on while a presentation is in progress!
I have already tried to use performSelector
with a delay of 0.4 and still not solve the problem.
How can I solve this?
Thanks
Solution