1

I want to display text in italic in UIAlertView. I would like to know how to do so.

I am currently thinking as follows:- There is no explicit label in an alert view. So we cannot set the font attribute. We just have an NSString in the message parameter of UIAlertView

Correct me if I am wrong.

So is there any solution or alternative?

Dinesh
  • 2,194
  • 3
  • 30
  • 52
  • You're right. You can't set the font AFAIK. It was possible before iOS 7. – Enrico Susatyo Jan 20 '14 at 12:44
  • So I tried to create a `UIView` with the labels I require but I have problem with resizing the labels. The message and title fields of `UIAlertView` automatically get resized. How can I do so with my UIView? Is there some way where I can implement all the other functionality of UIAlertView in the UIView? – Dinesh Jan 21 '14 at 03:05
  • Yes, if you want to re implement those, you can. – Enrico Susatyo Jan 21 '14 at 03:08

1 Answers1

0

There is no way to modify the text attribute in UIAlertView in iOS 7. It was possible in iOS 6.

One solution is to recreate the UIAlertView. This is relatively easy, explained in depth here. Or if you browse around GitHub there might be an implementation of it already.

Edit: Here is an implementation in GitHub.

Community
  • 1
  • 1
Enrico Susatyo
  • 19,372
  • 18
  • 95
  • 156
  • The code looks quite complex. Is there any simpler alternative? Is it possible to just work around with UILabel to automatically resize itself? – Dinesh Jan 21 '14 at 03:17
  • Well, that's how UIAlertView works. You can customise it any way you want. – Enrico Susatyo Jan 21 '14 at 03:22