I am currently dealing with the design which cannot be build using UIAlertController. How can I customize it?
-
1Please read [following help article](https://stackoverflow.com/help/minimal-reproducible-example) so that people can help you better. – SysC0mp Jun 26 '19 at 13:59
-
Hi, have you solved it , you can detail explain in question. – Junior Jiang Jul 02 '19 at 09:39
-
@JuniorJiang-MSFT Yes, did it with the help of TelerikUI – NIshank Jul 08 '19 at 12:04
-
@NIshank Great, you can share solution in answer .If my answer be helpful , thanks for voting up in advance. :) – Junior Jiang Jul 09 '19 at 01:13
3 Answers
You shouldn't change the AlertView, the recommended way is to use it as it, but if you really want to create your own Alert modal, you should use a ViewController. The Apple Docs state:
The UIAlertController class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.
So, you basically have to create a new Alert that inherits from UIViewController that's displayed as a popup, as you can see here

- 4,687
- 1
- 13
- 55
First you need clearly explain which effect you want in question.This document Displaying Alerts in Xamarin.iOS maybe helpful .
okayCancelButton.TouchUpInside += ((sender, e) => {
//Create Alert
var okCancelAlertController = UIAlertController.Create("Alert Title", "Choose from two buttons", UIAlertControllerStyle.Alert);
//Add Actions
okCancelAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, alert => Console.WriteLine ("Okay was clicked")));
okCancelAlertController.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, alert => Console.WriteLine ("Cancel was clicked")));
//Present Alert
PresentViewController(okCancelAlertController, true, null);
});

- 12,430
- 1
- 10
- 30
-
-
@MarkWardell Using `UIAlertAction.Create` to define `Button` , you can have a look at my shared documnet . – Junior Jiang Mar 10 '20 at 01:42
Unfortunately there is not much customization available for UIAlertController. You have to use Telerik UI (TKAlert View). And then on that TKAlert View you can add your custom view.

- 97
- 6