Thursday, 8 October 2015

Use Category With Custom Method In Ios/Iphone

=> Here Seeing One Of the Imporetd Categortt Concept:=

#import <objc/runtime.h>

static void *MyClassResultKey;
@implementation MyClass

=> Here taken One method Of which Using Category In Ios:

 - (NSString *)test {

  NSString *result = objc_getAssociatedObject(self, &MyClassResultKey);
  if (result == nil)

{
    // do a lot of stuff
    result = ...;
    objc_setAssociatedObject(self, &MyClassResultKey,

                  result, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
  }
  return result;
}
=> finaly Object set Associate object Using Category:-

 @end