In a root ViewController I am presenting a modal viewcontroller in full screen. This works fine most of the time. The issue I run into is when there is another Modal ViewController open as a form sheet. When this happens, my FullScreen VC is shown BEHIND the formsheet. What can I do about this?
Basically this "DemoViewController
" is functioning as a screensaver for my app.
demoVideoController = new DemoVideoController(this) { View = { Frame = View.Bounds } };
demoVideoController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
PresentViewController(demoVideoController, false, null);
Any ideas?
The UIViewController class defines the shared behavior that's common to all view controllers. You rarely create instances of the UIViewController class directly. Instead, you subclass UIViewController and add the methods and properties needed to manage the view controller's view hierarchy.
You can present your screensaver view in a new UIWindow that sits on top of all other windows in the app. For example, like this (assuming you have a UIWindow property named screenSaverWindow).
- (void)screenSaver
{
UIView *view = [[UIView alloc] initWithFrame:self.view.bounds];
view.backgroundColor = [UIColor blueColor];
self.screenSaverWindow = [[UIWindow alloc] initWithFrame:self.view.bounds];
self.screenSaverWindow.windowLevel = UIWindowLevelAlert + 1;
[self.screenSaverWindow addSubview:view];
[self.screenSaverWindow makeKeyAndVisible];
}
My guess is that the model and the form controllers are being presented by different controllers.
Try to present everything from the same controller like window.rootController
.
That way you can test if there is already a presentedViewController
and dismiss it before presenting your modal one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With