Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Dismiss UIAlertView programmatically in Xamarin.iOS

$
0
0

Hi All,

I am stuck in a weird scenario where I need to programmatically dismiss the active UIAlertView from the other viewcontroller by getting the instance.

Actually, I am working on AutoClose feature (working on System.Timer) where when Timer would be elapsed, I need to perform some operation (performs in View Model) and close the active UIAlertView or UIViewController window and Navigate To HomeView.

I am able to do with UIViewController but I couldn't find any way to dismiss the UIAlertView which is presented from another view controller?

Note - I understand this API is deprecated but for using UIAlertController it would lead to ample code changes. So, I would not prefer to do it as of now since it's urgent requirement for me

Can anyone help me here? I would greatly appreciate your help. Thanks.

I am using below method to accomplish but once the AlertView gets dismissed I am unable to click anywhere on screen.

    UIWindow window = UIApplication.SharedApplication.KeyWindow;
    UIViewController rootViewController=window.RootViewController;

    if(rootViewController.ModalViewController is UIAlertController)
    {
        rootViewController.ModalViewController.DismissViewController(true,null);    
    }

Also, may I know how do we see the hierarchy of Views in Xamarin Studio?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>