title: Add sub tableview on tableview
body: <p>I've a little problem with this:</p>
  
  <p><a href="http://i.stack.imgur.com/4JVIR.gif" rel="nofollow">gif animation</a></p>
  
  <p>A tableview is added on my view to show categories and another tableview added when category selected for display subcategories. But interaction with the top cell is not recognized and I don't understand why ! If anyone as an idea to fix this problem, or another way to make those animations possible .. </p>
  
  <p>Code is complicated to show but I'll try to explain clearly:</p>
  
  <ol>
  <li>The main controller is <code>FilterViewController</code> inherit from <code>UIViewController</code></li>
  <li>When the "Categories" row selected, an instantiation of <code>CategoryFilterViewController</code> created and the view added to the <code>FilterViewController's</code> view.</li>
  <li>On the <code>CategoryFilterViewController</code>, when a row selected, I instantiate new tableView and add it to the view.</li>
  </ol>
  
  <p><a href="http://i.stack.imgur.com/3KNYq.png" rel="nofollow">CategoryViewController storyboard view</a></p>
  
  <p>A part of <code>FilterViewController</code>, variables and outlets <br>
  You can see I used SnapKit to make some constraints programmatically</p>
  
  <pre><code>var contentViewCatHeightContrain: Constraint? = nil
  var contentViewCatBottomContrain: Constraint? = nil
  
  @IBOutlet weak var filterTableView: UITableView!
  @IBOutlet weak var submitFilterButton: UIButton!
  </code></pre>
  
  <p>You see here, when "Categories" row selected, I run this code.</p>
  
  <pre><code>func displayCat(show: Bool, cell: FilterCell) {
       let cellRow = self.filterTableView.indexPathForCell(cell)!
       if(cellRow.row == 0) {
           if(self.viewModel.categoryContentsView == nil) {
               if let vc = self.storyboard?.instantiateViewControllerWithIdentifier("CategoryFilterView") as? CategoryFilterView {
                   self.viewModel.categoryContentsView = vc
                   self.viewModel.categoryContentsView.view.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, 0)
                   self.view.addSubview(self.viewModel.categoryContentsView.view)
                   self.addChildViewController(vc)
                   self.viewModel.categoryContentsView.view.snp_makeConstraints(closure: { (make) -&gt; Void in
                       self.contentViewCatHeightContrain = make.height.equalTo(0).constraint
                       make.left.equalTo(0)
                       make.right.equalTo(0)
                       self.contentViewCatBottomContrain = make.bottom.equalTo(0).constraint
                   })
               }
           }
           self.viewModel.categoryContentsView.view.didMoveToSuperview()
           self.view.bringSubviewToFront(self.viewModel.categoryContentsView.view)
       }
  }
  </code></pre>
  
  <p>And on the <code>CategoryViewController</code>, outlets:</p>
  
  <pre><code>@IBOutlet weak var catTableView: UITableView!
  @IBOutlet weak var topCatTableView: NSLayoutConstraint!
  @IBOutlet weak var subCatHeightContrain: NSLayoutConstraint!
  @IBOutlet weak var subCatTableView: UITableView!
  </code></pre>
  
  <p>and when row selected:</p>
  
  <pre><code>func showHideTableView(show: Bool) {
      if(show) {
          self.topCatTableView.constant = -75
          self.subCatHeightContrain.constant = UIScreen.mainScreen().bounds.size.height - 95
      }
      else {
          self.topCatTableView.constant = 0
          self.subCatHeightContrain.constant = 0
          self.catTableView.reloadData()
      }
  }
  </code></pre>