title: Objective-c overriding delegate with its descendant type
body: <p>I have textView in my cell and sometimes during tableView scroll some weird calls happen. System make my textView first responder. I've found these calls do unwanted behavior:</p>
  
  <pre><code>#0 -[UITextView canBecomeFirstResponder] ()
  #1 -[UIView(Hierarchy) deferredBecomeFirstResponder] ()
  #2 -[UIView(Hierarchy) _promoteDescendantToFirstResponderIfNecessary] ()
  </code></pre>
  
  <p>I can't find out why are these called, so I've tried to deal with this by extending <code>UITextView</code> and overriding <code>- canBecomeFirstResponder</code>.</p>
  
  <p>Here is my .h:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @protocol TextViewDelegate;
  
  @interface TextView : UITextView
  
  @property (nonatomic, assign) id&lt;TextViewDelegate&gt; delegate;
  
  @end
  
  @protocol TextViewDelegate &lt;UITextViewDelegate&gt;
  
  - (BOOL)canBecomeFirstResponder:(TextView *)textView;
  
  @end
  </code></pre>
  
  <p>And .m:</p>
  
  <pre><code>#import "TextView.h"
  
  @implementation TextView
  
  @synthesize delegate;
  
  - (BOOL)canBecomeFirstResponder
  {
      return [self.delegate respondsToSelector:@selector(canBecomeFirstResponder:)] ? [self.delegate canBecomeFirstResponder:self] : NO;
  }
  
  @end
  </code></pre>
  
  <p>This solution works but on the line <code>@property (nonatomic, assign) id&lt;TextViewDelegate&gt; delegate;</code> I've got warning and I don't know why. It says <code>Property type 'id&lt;TextViewDelegate&gt;' is incompatible with type 'id&lt;UITextViewDelegate&gt;' inherited from 'UITextView'</code>.</p>
  
  <p>So why system want to make textView first responder if I do not? Why I'm getting this warning? Is there better solution than mine?</p>