ios - UIAlertView 应该被子类化吗?

标签 ios objective-c cocoa-touch uialertview

我确信答案是“ no ”,因为文档非常清楚。但我有点困惑。一个标准UIAlertView很乏味,我想改善外观,似乎其他应用程序也这样做(参见下面的示例)。

另一种可能性是它们没有子类 UIAlertViews .在这种情况下,这是如何实现的?

页面UIAlertViews状态

Appearance of Alert Views

You cannot customize the appearance of alert views.



那么我们如何获得类似于此处显示的示例的内容呢?

enter image description here

最佳答案

不,不要子类化它。从文档:

Subclassing Notes

The UIAlertView 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.


你可以做的是创建一个 UIView 并让它的行为类似于 UIAlertView。这不是很困难,似乎是他们在你的行动中所做的。

关于ios - UIAlertView 应该被子类化吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21007058/

相关文章:

objective-c - Cocoa-为什么我应该把我的 statusItem 放在 ApplicationDelegate 中?

swift - 用 Swift 代码包装一个 C++ 库,编译为 Cocoa Touch 框架

html - CSS 溢出 : auto in some elements don't work

ios - 包含另一个自定义对象数组的自定义对象数组上的 NSPredicate

ios - 如何在CABasicAnimation启动之前防止CAShapeLayer绘制

iphone - iOS:路由器IP可达?

ios - 计算一个单词在 TableView 行中出现的次数

ios - 如何使用 Swift 创建 "hyperlink"?

ios - Firebase 查询的问题

iOS:按钮的动画减速