This is an attribute, not a variable. Add attributes to the class and corresponding variables will be automatically generated. And adding attributes in the category will not generate corresponding instance variables. Because methods can be added to categories, you can think of: @property(nonatomic, copy) NSString *name; Actually, a set and get method is added
This is an attribute, not a variable.
Add attributes to the class and corresponding variables will be automatically generated.
And adding attributes in the category will not generate corresponding instance variables.
Because methods can be added to categories, you can think of:
@property(nonatomic, copy) NSString *name; Actually, a set and get method is added
objc is a dynamic language, we can add properties to existing classes at runtime.
For example in SVPullToRefresh:
Adding attributes actually declares the set and get methods, but the specific set and get methods must be implemented by yourself.