title: UITableView section header clickable Delegate not Call
body: <p>I am new to ios development. I am create app in Storyboard, Initially <strong>UItableviewController with one prototype cells</strong>, with button and labels. The <strong>button</strong> has <strong>IBAction</strong> method in it <strong>UItableViewCell</strong> Class, the class has <strong>Delegate</strong> to <strong>UItableviewController</strong>,the delegate method does not called. But the Images in section view is change. The  i post my full code here. </p>
  
  <p><a href="http://iosstoryboard.blogspot.in/p/uitableview-section-header-clickable.html" rel="nofollow">Download whole project from Link</a></p>
  
  <p><strong>ContactHeaderViewCell.h</strong></p>
  
  <pre><code>@protocol SectionClick;
  @protocol SectionClick &lt;NSObject&gt;
  @optional
  - (void) TickCheckbox : (NSInteger) section;
  - (void) UnTickCheckbox : (NSInteger) section;
  @end
  @interface ContactHeaderViewCell : UITableViewCell
  {
  id&lt;SectionClick&gt; HeaderDelegate;
  }
  
  @property (strong, nonatomic) IBOutlet UILabel *lblName;
  @property (strong, nonatomic) IBOutlet UIButton *btnCheckBox;
  @property (strong, nonatomic) IBOutlet UIButton *btnArrow;
  - (IBAction)btnCheckBox_click:(id)sender;
  - (IBAction)btnArrow_Click:(id)sender;
  
  
  @property (nonatomic, strong) id&lt;SectionClick&gt; HeaderDelegate;
  @property (nonatomic) NSInteger section;
  - (void) setDelegate:(id)delegate;
  
  @end'
  </code></pre>
  
  <p><strong>ContactHeaderViewCell.m</strong></p>
  
  <pre><code>@implementation ContactHeaderViewCell
  
  @synthesize HeaderDelegate,section;
   - (void) setDelegate:(id)delegate
  {
  self.HeaderDelegate = delegate;
  }
  - (void)awakeFromNib {
  // Initialization code
  }
  
  - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  [super setSelected:selected animated:animated];
  
  // Configure the view for the selected state
  }
  
  - (IBAction)btnCheckBox_click:(id)sender {
  self.btnCheckBox.selected = !self.btnCheckBox.selected;
  
  if (self.btnCheckBox.selected)
  {
      if ([self.HeaderDelegate respondsToSelector:@selector(UnTickCheckbox:)])
      {
          [self.HeaderDelegate UnTickCheckbox:self.section];
      }
  } else
  {
      if ([self.HeaderDelegate respondsToSelector:@selector(TickCheckbox:)])
      {
          [self.HeaderDelegate TickCheckbox:self.section];
      }
  }
  }
  </code></pre>
  
  <p><strong>ContactTableViewController.m</strong></p>
  
  <pre><code>#import "ContactDetail.h"
  #import "ContactHeaderViewCell.h"
  
  @interface ContactTableViewController : UITableViewController&lt;SectionClick&gt;
  @property(nonatomic) ContactDetail *contacts;
  @property(nonatomic) NSMutableArray *ContactList;
  @end
  </code></pre>
  
  <p><strong>ContactTableViewController.m</strong></p>
  
  <pre><code>#import "ContactTableViewController.h"
  #import &lt;AddressBook/AddressBook.h&gt;
  #import "ContactHeaderViewCell.h"
  #import "UserDetailViewCell.h"
  
  @interface ContactTableViewController ()
  
  @end
  
  @implementation ContactTableViewController
  
  - (id)initWithStyle:(UITableViewStyle)style
  {
      self = [super initWithStyle:style];
      if (self) {
      }
      return self;
  }
  - (void)viewDidLoad {
      [self ArrayContactFunc];
      [super viewDidLoad];
  }
  
  - (void)didReceiveMemoryWarning {
      [super didReceiveMemoryWarning];
  }
  
  #pragma mark - Table view data source
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
      return [self.ContactList count];
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
      self.contacts =(self.ContactList)[section];
      return (self.contacts.Isopen) ? [self.contacts.mobileNumbers count] : 0;
  }
  
  -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  {
      static NSString *HeaderIdentifier = @"HeaderCell";
      self.contacts = (self.ContactList)[section];
      ContactHeaderViewCell *HeaderView = (ContactHeaderViewCell *)[self.tableView dequeueReusableCellWithIdentifier:HeaderIdentifier];
      if (HeaderView == nil){
          [NSException raise:@"headerView == nil.." format:@"No cells with matching CellIdentifier loaded from your storyboard"];
              }
      HeaderView.lblName.text = self.contacts.fullName;
          if(self.contacts.IsChecked)
          {
              [HeaderView.btnCheckBox setImage:[UIImage imageNamed:@"Unchecked.png"] forState:UIControlStateSelected];
          }
          else
          {
              [HeaderView.btnCheckBox setImage:[UIImage imageNamed:@"Checked.png"] forState:UIControlStateSelected];
          }
      return HeaderView;
  }
  
  - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      self.contacts = (self.ContactList)[indexPath.section];
      static NSString *DetailCellIdentifier = @"DetailCell";
      UserDetailViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:DetailCellIdentifier];
      if(!cell)
      {
           [NSException raise:@"headerView == nil.." format:@"No cells with matching CellIdentifier loaded from your storyboard"];
      }
  
      cell.lblDetail.text = (self.contacts.mobileNumbers)[indexPath.row];
      return cell;
  }
  
  - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  {
      return 60.0;
  }
  -(void)UnTickCheckbox:(NSInteger)section
  {
  //    self.contacts = (self.ContactList)[section];
  //    self.contacts.IsChecked = NO;
  //    [self.tableView reloadData];
  }
  
  -(void)TickCheckbox:(NSInteger)section
  {
  //    self.contacts = (self.ContactList)[section];
  //    self.contacts.IsChecked = YES;
  //    [self.tableView reloadData];
  }
  </code></pre>
  
  <p>Thank in advance.</p>