Advertisement
agrippa1994

Test

Aug 8th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @protocol Delegate
  2. @required
  3. - (void) onCall;
  4. @end
  5.  
  6. @interface CallCore : NSObject{
  7.     id delegate;
  8. }
  9.  
  10. + (id)initWithDelegate:(id)obj;
  11.  
  12. - (void) callOnCall;
  13.  
  14.  
  15. @property id delegate;
  16.  
  17. @end
  18.  
  19. @interface Call : NSObject<Delegate>{
  20.     CallCore *caller;
  21. }
  22.  
  23.  
  24. @property CallCore *caller;
  25. @end
  26.  
  27.  
  28.  
  29. @implementation CallCore
  30.  
  31. @synthesize delegate = _delegate;
  32.  
  33. + (id)initWithDelegate:(id)obj
  34. {
  35.     CallCore *retn = [[CallCore alloc] init];
  36.     [retn setDelegate:obj];
  37.    
  38.     return retn;
  39. }
  40.  
  41. - (void) callOnCall
  42. {
  43.     if([[self delegate] conformsToProtocol:@protocol(Delegate)])
  44.         [[self delegate] onCall];
  45. }
  46.  
  47. @end
  48.  
  49.  
  50. @implementation Call
  51. @synthesize caller = _caller;
  52.  
  53. - (id) init{
  54.     caller = [CallCore initWithDelegate:self];
  55.     [caller callOnCall];
  56.     return self;
  57. }
  58.  
  59. - (void) onCall{
  60.     printf("Call::onCall");
  61. }
  62.  
  63. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement