title: different methods on one standard headCell in func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
body: <p>I have 2 tableviews in the same view controller: "studentsTable" and "professorsTable". I wanted to create a standard head cell for both tables. I subclassed the UItableViewCell and created headCell type. Then assigned one headCell to both if indexPath.row==0.   Everything went smooth, however, there is 1 problem. Whenever I click the "addingButton" I want  "addStudent" function to be called if it was on "studentsTable" and "addProfessor" if it was on "ProfessorsTable". Obviously I can just create two headCells, one for each of the tables but I wonder if there is a more professional way of handling this with writing less code.
   Here is the code I suppose may work if the right "if" condition is given.
  Thanks in advance</p>
  
  <pre><code> func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell{
  
    var actionType:String=String()
  
    if(/*WHAT CONDITION SHOULD I PUT?*/)
      {actionType="addStudent"}
     else
     {actionType="addProfessor"}
  
  
      if(indexPath.row==0)
             {  
               var theHeadcell : headCell = tableView.dequeueReusableCellWithIdentifier("headCell") as headCell
  
             // cell setup
  
               if(actionType != "")
                  {
                     addButton.addTarget(self, action: NSSelectorFromString(actionType), forControlEvents: UIControlEvents.TouchUpInside)
                  }
                return theHeadCell
             }
  
      else
       { 
          if (tableView==self.studentsTable)
               {
                   var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("studentsCell") as UITableViewCell
  
                    // cell setup
                    return cell
               }
  
         else 
             {
                      var cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("ProfessorsCell") as UITableViewCell
  
                  // cell setup
                  return Cell
             }
  
     }        
  }
  </code></pre>