title: how to extend a protocol for a delegate in objective C, then subclass an object to require a conforming delegate
body: <p>I want to subclass UITextView, and send a new message to the delegate. So, I want to extend the delegate protocol.  What's the correct way to do this? </p>
  
  <p>I started out with this:</p>
  
  <p>interface: </p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @class MySubClass;
  
  @protocol MySubClassDelegate &lt;UITextViewDelegate&gt;
  - (void) MySubClassMessage: (MySubClass *) subclass;
  @end
  
  
  @interface MySubClass : UITextView {
  }
  
  @end
  </code></pre>
  
  <p>implementation: </p>
  
  <pre><code>#import "MySubClass.h"
  
  
  @implementation MySubClass
  
  - (void) SomeMethod; { 
      if ([self.delegate respondsToSelector: @selector (MySubClassMessage:)]) { 
          [self.delegate MySubClassMessage: self];
      }
  }
  
  @end
  </code></pre>
  
  <p>however with that I get  the warning: <code>'-MySubClassMessage:' not found in protocol(s)</code>. </p>
  
  <p>I had one way working where I created my own ivar to store the delegate,  then also stored the delegate using <code>[super setDelegate]</code>  but that seemed wrong.  perhaps it's not. </p>
  
  <p>I know I can just pass id's around and get by, but My goal is to make sure that the compiler checks that any delegate supplied to MySubClass conforms to MySubClassDelegate protocol.</p>
  
  <p>To further clairfy: </p>
  
  <pre><code>@interface MySubClassTester : NSObject {
  
  }
  
  @implementation MySubClassTester
  
  - (void) one { 
      MySubClass *subclass = [[MySubClass alloc] init];
      subclass.delegate = self;
  }
  
  @end
  </code></pre>
  
  <p>will produce the warning: <code>class 'MySubClassTester' does not implement the 'UITextViewDelegate' protocol</code></p>
  
  <p>I want it to produce the warning about not implementing 'MySubClassDelegate' protocol instead.</p>