How does a Category Works in iOS?

Posted by  Ankita Pandey
 2087  View(s)
Rate this:
I have created an application using Objective-C code. In my code I have a need for extending a standard class of a iOS framework with an instance variable plus accessors.
I learn learn Apple's developer documentation about 'Category' and its sounds pretty confusing to me.

Can anyone tell me the basic functionality of Category.
  1. Re: How does a Category Works in iOS?

    Category is a unique feature in iOS because with this help we can add our custom methods inside our own classes or predefined classes means(framework classes).
    for example- I have created a custom method and I want to use this method anywhere in our Application. now at this condition we can add this method into any framework class using Category.

    Now, if you need to add instance variables to a class, a category would not do the job, categories only add methods not data.
    So, to add instance variables you must subclass.