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.