Class Cluster
来源:互联网 发布:两个表格数据匹配重复 编辑:程序博客网 时间:2024/05/21 10:38
UIButton is not a class cluster at all. A class cluster is represented by a public abstract class, that means no instance variables, with a bunch of private concrete subclasses that provide the implementation of the abstract methods of the abstract class. UIButton on the other hand is a concrete class, none of its methods is abstract, and it has instance variables to store the value you pass through its arguments. The only problematic part is that +buttonWithType can instantiate subclasses instead of UIButton directly, thus it can be seen as a factory method, not a class-cluster
/**Subclassing UIButton is definitely dangerous, because UIButton not a single class but a class cluster. I highly recommend not doing this. According to Apple:
The class cluster architecture involves a trade-off between simplicity and extensibility: Having a few public classes stand in for a multitude of private ones makes it easier to learn and use the classes in a framework but somewhat harder to create subclasses within any of the clusters.
A new class that you create within a class cluster must:
-Be a subclass of the cluster’s abstract superclass
-Declare its own storage
-Override the superclass’s primitive methods
Instead of adding a property to the category, you can use associative references and add getter and setter methods to the category to simulate a property on the button.*/
Ref:
http://stackoverflow.com/questions/11475364/how-to-figure-out-how-many-times-a-uibutton-has-been-pressed
Class Cluster
http://stackoverflow.com/questions/5045672/create-uibutton-subclass
- Class Cluster
- Class Cluster
- 类簇Class cluster
- IOS class cluster
- 【iOS】类簇(class cluster)
- 【iOS】类簇(class cluster)
- objc’s category and class cluster 详解
- objc’s category and class cluster 详解
- objc’s category and class cluster(类簇)
- iOS 类簇(Class Cluster)使用心得
- iOS抽象工厂模式-class cluster
- iOS类簇(Class Cluster)使用心得
- cluster
- Cluster
- cluster
- Cluster
- Cluster
- weblogic cluster
- python学习笔记之python中处理中文
- 网络-REST与SOAP之对比
- 第一个Android应用程序
- ATX电源的工程应用
- Java--UDP通信(单向)
- Class Cluster
- iPhone 5/4/4S iPad 1/2/3/mini 界面设计标准。
- 1730_Crazy Tea Party(有点难)
- 数论(fabonacci数列) hdu-1568-Fibonacci
- iphone ios 如何使用gcd
- 匈牙利算法
- doget与dopost的区别
- JSR-303使用依赖jar包
- 开发环境大致步骤