我想继承 UIActionSheet
以便我可以添加 block API。
我想子类化,这样我仍然可以享受操作表的“ self 保留”行为。
我更喜欢它而不是创建一个将 UIActionSheet
作为实例保存的对象,因为那样我将需要保存对该对象的引用,因此它不会被释放。
所以我的问题是,我可以继承 UIActionSheet
(Apple 会允许吗)?
我只是不确定,因为我在 UIActionSheet
类引用中看到:
Subclassing Notes:
UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the UIActionSheet API, you can create your own and present it modally with presentViewController:animated:completion:.
答案是否定的。如果您将 UIActionSheet 子类化,您的应用程序在发送到 Apple App Store 时可能会被拒绝。如果 UIActionSheet 不能满足您的需求,您需要实现自己的自定义操作表。这同样适用于 UIAlertView。
这显然是 stated in the documentation :
UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the UIActionSheet API, you can create your own and present it modally with
presentViewController:animated:completion:
.
关于ios - 继承 UIActionSheet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21884520/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |