title: custom delegate ios respondsToSelector not working custom table cell
body: <p>Hi I'm new to delegation, and what I have is a TableView with a custom table view cell which contains the delegate protocol. </p>
  
  <p>And when I click on the button which is subiew of custom view cell it will fire up an event that will pass a value to my ViewControllers method.</p>
  
  <p>TableView is inside the view controller.</p>
  
  <p>The customviewcell is working properly I even log when the button click and it works fine but when it doesn't want to enter the condition called <code>self.delegate respondsToSelector:@selector(btnEditParentLabelText:)</code>  </p>
  
  <p>Here is my customviewcell.h</p>
  
  <pre><code>//  ParentTableCell.h
  
  
  #import &lt;UIKit/UIKit.h&gt;
  @protocol ParentTableCellDelegate &lt;NSObject&gt;
  @optional
  - (void)btnEditParentLabelText:(NSString *)amountParentLabel;
  @end
  
  @interface ParentTableCell : UITableViewCell
  
  @property (strong,nonatomic) IBOutlet UITextField *parentLabel;
  @property (nonatomic, weak) id &lt;ParentTableCellDelegate&gt;delegate;
  
  
  -(IBAction)btnEditParentLabel:(id)sender;
  
  @end
  </code></pre>
  
  <p>customviewcell.m (not all codes just the one needed for delegation)</p>
  
  <pre><code>//  ParentTableCell.m
  
  #import "ParentTableCell.h"
  
  -(IBAction)btnEditParentLabel:(id)sender{
      NSLog(@"click btn");
      if ([self.delegate respondsToSelector:@selector(btnEditParentLabelText:)]) {
          NSLog(@"Inside");
          [self.delegate btnEditParentLabelText:@"test"];
      }
  
  };
  
  @end
  </code></pre>
  
  <p>Here is my view controller where I implement the TableParentCellDelegate and contains the TableView</p>
  
  <pre><code>//  PositionViewController.h
  
  #import &lt;UIKit/UIKit.h&gt;
  #import "ParentTableCell.h"
  
  @interface PositionViewController : UIViewController&lt;UITableViewDelegate,UITableViewDataSource,UIAlertViewDelegate,ParentTableCellDelegate&gt;
  {
      UIAlertView *addPostionpopup;
  }
  #define addPositionAlert 1
  #define deletePositionAlert 2
  @property(nonatomic,strong) IBOutlet UITableView *positionTable;
  
  - (IBAction)btnAddPosition:(id)sender;
  
  @end
  </code></pre>
  
  <p>And its m file ill just put the method that is used for the delegate:</p>
  
  <pre><code>- (void)btnEditParentLabelText:(NSString *)amountParentLabel{
      NSLog(@"&gt;&gt;&gt; %@", amountParentLabel);
  }
  </code></pre>
  
  <p>Is there something wrong in my implementation? </p>
  
  <p>Thanks</p>