Objectiv-C Class extension,
There are several methods to Expand functions for classes in oc:
1. Subclass: Extend functions by inheriting classes and adding methods (this method can expand methods or instance variables)
2. directly modify the source code in this class
3. Category
Category is a category.
It is an extension function for classes without source code. The extended function will become part of the original class and can be directly called through the original class or the object of the original class, and can inherit
This method can only be used to expand methods, but not instance variables (you can use category to override the class method)
Create category extension NSString class: Create File NSString + AddMethod. h and NSString + ADDMethod. m
(1) Declare the method to be added in the class object. h file
@ Interface NSString (AddMethod)
//