0

I am currently dealing with the design which cannot be build using UIAlertController. How can I customize it?

NIshank
  • 97
  • 6

3 Answers3

0

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

Saamer
  • 4,687
  • 1
  • 13
  • 55
0

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);
});
Junior Jiang
  • 12,430
  • 1
  • 10
  • 30
0

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.

NIshank
  • 97
  • 6