1

I have gone through different solutions on stackoverflow and other websites. But I just know about change about title and message fonts and colors. But Can we change button font's too?

I know we can change button textcolor but I want to change font's too. Means I want to customise whole alertcontroller including buttons too.

Jitendra Modi
  • 2,344
  • 12
  • 34
  • You can create your own AlertController. Create a new ViewController in Storyboard or via code then present it modally – Sahil Manchanda Sep 24 '18 at 10:14
  • That's why I specify default Alertcontroller, I don't want to create ViewController. @SahilManchanda – Jitendra Modi Sep 24 '18 at 10:15
  • 1
    Possible duplicate of [UIAlertController custom font, size, color](https://stackoverflow.com/questions/26460706/uialertcontroller-custom-font-size-color) – Scriptable Sep 24 '18 at 10:20
  • @Scriptable I specify my question that I want to change Default button's font style. I know we can change title and message font style and color. Just read my question carefully and then comment. – Jitendra Modi Sep 24 '18 at 10:23
  • the comment says 'possible', not that it definitely was. – Scriptable Sep 24 '18 at 10:27
  • @Scriptable I am looking for an answer, just possible is not my answer. from that duplicate question I am not getting my answer. Just look at that duplicate question it's all answer's are define customize alwertcontroller but excluding button font style. – Jitendra Modi Sep 24 '18 at 11:19
  • I think the answer is that you need to create a custom alert controller. I dont think you can do it any other way unless you use a library to create custom one for you – Scriptable Sep 24 '18 at 11:36
  • So that's impossible in your way to do it in default alertcontroller. I know i have to create custom alertcontroller but if it is possible then it saves lot of time of mine @Scriptable – Jitendra Modi Sep 24 '18 at 11:40
  • Did you tried with attributedText? – Retterdesdialogs Sep 24 '18 at 11:52

1 Answers1

1

From the docs:

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.

Modification is only possible with the help of Private API. which is not a good practice and App may get rejected for using Private API.

Community
  • 1
  • 1
Sahil Manchanda
  • 9,812
  • 4
  • 39
  • 89