Is there anyway that I can remove a method that is added in category?
I dont want to subclass or comment that category?
Kindly tell me what will happen if I create a category use it and later on I want not to use it anymore.
I am new to cocoa, so any help and suggestions please….
Is there anyway that I can remove a method that is added in category?
Share
Objective-C is a dynamic language and lacks any strong concept of hiding; public, private, protected etc.; methods, especially at runtime. As a consequence of this a child class cannot hide an inherited method, which is possible in some languages.
So the simple, and recommended answer, is that you cannot remove or hide a method.
But given the very dynamic nature of Objective-C, never say never… but really you shouldn’t go there!
The standard way to reduce the exposure of a class is to have another class privately own an instance of the class and moderate all access to it. If you are pattern-oriented you will find patterns which do this.