title: Get the custom UITableViewCell that contains the UIButton pressed
body: <p>So I have a custom UITableViewCell class:</p>
  
  
  
  <pre><code>class customCell{
       let button1 = UIButton()
       let view1 = UIView()
       view1.frame = CGRectMake(30, 60, 10, 10)
       view1.backgroundColor = UIColor.blueColor()
       button1.frame = CGRectMake(10,10,50,50)
       button1.addTarget(tableView(), action: "test:", forControlEvents: .TouchUpInside)
  }
  </code></pre>
  
  <p>And this is what my view controller looks like, with irrelevant code omitted:</p>
  
  
  
  <pre><code>class tableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
      let table = UITableView()
      let currentCell = customCell()
      var selectedIndexPath: NSIndexPath? = nil
  
      func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
          selectedIndexPath = indexPath
          let cell = table.cellForRowAtIndexPath(indexPath) as! customCell
          currentCell = cell
          table.beginUpdates()
          tableView.endUpdates()
      }
  
     func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -&gt; CGFloat {
         if (selectedIndexPath != nil &amp;&amp; indexPath.row == selectedIndexPath!.row &amp;&amp; indexPath.section == selectedIndexPath!.section){
             return 155
          }
         return 90
      }
  
     func test(sender:UIButton){
         currentCell.view1.hidden = true // does not work    
     }
  }
  </code></pre>
  
  <p>As marked in the code, when I use <code>currentCell</code> to hold the cell selected and try to manipulate its subviews, i.e. hide a subview, it does not work. It seems like <code>currentCell</code> does not refer to the selected cell in the tableView at all.</p>