Three major functions of the category
1. Add methods to existing classes, you can increase the object method, or you can add static methods.
If the added method is a method of this kind, then this method may overwrite the original method or it may not overwrite it.
Categories can only increase the methods of existing classes and cannot increase the properties of the class
2. Declaring a private method
You can use categories to implement the declaration of a private method (a method that you do not want to leak in the header file) to prevent the compiler from warning @interface categorytestviewcontroller (privatemethods)-(void) Testprivatemethod, @end @implementation Categorytestviewcontroller (privatemethods)-(void) testprivatemethod{} @end
3. The same class of code, scattered into different files, such as Nsindexpath, a part of the method is written in the Uitableview.h
Use of categories in iOS