如何减小 UIAlertView 中按钮的字体大小,有什么办法吗?

How to decrease the Font size of a button in UIAlertView,is there any way to do so?

我正在使用 UIalertView,

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:appname
                                                message:@"some blah blah!"
                                               delegate:nil
                                      cancelButtonTitle:@"Ok"
                                      otherButtonTitles:@"Free content", nil];
[alert show];

我想在警报视图弹出时减小 "Free content" 的字体大小(类似于 arial-9)字体,有什么方法可以减小字体或以自定义方式设计它吗?

谢谢,

You cannot customize the appearance of UIAlertView,

因为此 class 的视图层次结构是 私有的 并且必须不能修改

有关更多信息,请参阅 UIAlertView Class 参考:UIAlertView Class Reference:

为什么不呢?

you can use Custom AlertView with desire apperance

请参阅下文link如何创建具有所需外观的自定义警报视图CustomAlertView Sample

UIAlertView 已从 iOS8 开始弃用。您需要从 iOS8 开始使用 UIAlertController。您可以使用键值编码使用 attributedTitle 键设置 UIAlertController 的按钮字体。

有关此处提供的答案的更多信息。

UIAlertController custom font, size, color