在iOS7中更改UIAlertView的字体大小 [英] Change font size for UIAlertView in iOS7

查看:99
本文介绍了在iOS7中更改UIAlertView的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在alertView中更改消息文本和标题文本的字体大小。 Apple网站上没有关于此的文档,但苹果在其子类注释中说UIAlertView类旨在按原样使用。请参考以下链接。 https://developer.apple.com/library /ios/documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html

I want to change the font size of message text and title text in alertView. There is no documentation in apple site that speaks about this but apple says "The UIAlertView class is intended to be used as-is" in their subclassing notes. Please refer the below link. https://developer.apple.com/library/ios/documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html

如果要更改警报视图文本大小,我真的很困惑避免或可以改变?任何人都可以告诉我这方面的最佳做法是什么?

I am really confused if changing an alert view text size is something to be avoided or can it be changed? Can anyone advise me on What is the best practice for this?

如果文本大小可以更改,你还可以提供一些方法吗?

If the text size can be changed, can you also provide some way of doing this?

推荐答案

是的,这是正确的UIAlertView类旨在按原样使用。您不应该直接访问UIAlertView中的任何标签,也不应该将UIAlertView子类化 - 这是Apple明确说明的,并且在发送到Apple Store时可能会导致您在修订期间拒绝您的应用程序。这同样适用于UIActionSheet。

Yes that's correct "The UIAlertView class is intended to be used as-is". You should not access any labels in UIAlertView directly as well as you should not subclass UIAlertView - this is clearly stated by Apple and is likely to lead to a rejection of your App during revision when sent for publication to the Apple Store. The same applies to UIActionSheet.

这解释了为什么您无法通过UIAlertView的公共API访问任何UILabel。从技术上讲,您仍然可以访问它们,查看UIAlertView子视图的内容NSArray属性 - 实际上包含所有子视图,包括UILabel和UIButton实例。但是如上所述,你绝对应该避免这样做,而则考虑实现你自己的警报视图,以便在需要时以模态方式加载。

This explains why you are not given the possibility to access any UILabel via the public API of UIAlertView. Technically you can still access them looking at the content of your UIAlertView subviews NSArray property - that in fact contains all the subviews which include UILabel and UIButton instances. However as mentioned you should absolutely avoid doing this and instead look into implementing your own alert view to be loaded modally when needed.

这篇关于在iOS7中更改UIAlertView的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆