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

Xamarin.ios Close ActionSheet when tap on screen

$
0
0

I'm creating a UIAlertController with ActionSheet style:

 UIAlertController actionSheetAlert = UIAlertController.Create(null, null, UIAlertControllerStyle.ActionSheet);

I'm adding an action to it:

 UIAlertAction alertAction = UIAlertAction.Create("Action", UIAlertActionStyle.Default, DoSomting);
 var alertImage = UIImage.FromBundle("image")
             .ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
 alertImage = ResizeImage(sortingAlertImage, 32, 32)
             .ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
 alertAction.SetValueForKey(alertImage, new NSString("image"));
 alertAction.SetValueForKey(UIColor.Black, new NSString("titleTextColor"));
 actionSheetAlert.AddAction(alertAction);

And display it:

 PresentViewController(_actionSheetAlert, true, null);

How can I close the UIAlertController when tapping on screen?

I can do it by adding a "cancel" action like this:

 var cancelAlertAction = UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null);
 cancelAlertAction.SetValueForKey(UIColor.Black, new NSString("titleTextColor"));
 actionSheetAlert.AddAction(cancelAlertAction);

But I don't want to display the cancel action.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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