title: How to acces a view from tableViewCell to TableViewController
body: <p>I have a <code>UITableViewController</code> and <code>UITableViewCell</code>. Now I am try to access a view from a <code>UITableViewCell</code> to <code>UITableViewController</code> by <code>didSelectRowAt</code> function. But I could not do it.</p>
  
  <p><strong>TableViewController</strong></p>
  
  <pre><code>import Foundation
  import UIKit
  
  class FlipViewCon: UIViewController, UITableViewDelegate, UITableViewDataSource{
      let flipCellId = "flipCellid"
  
      let flipTableView: UITableView = {
          let tableView = UITableView()
          tableView.backgroundColor = .green
  
          return tableView
      }()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          self.view.backgroundColor = .gray
  
          flipTableView.delegate = self
          flipTableView.dataSource = self
  
          flipTableView.frame = CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height)
  
          self.view.addSubview(flipTableView)
  
          flipTableView.register(FlipTableViewCell.self, forCellReuseIdentifier: flipCellId)
      }
  
      let countryArray = ["bangladesh", "nepal", "china", "malaysia", "thai land", "japan", "England", "canada"]
      let cityArray = ["Dhake","Kathmandu",  "Beijing", "Kuala Lumpur", "Bangkok", "tokeyo", "London", "Torento"]
  
      func numberOfSections(in tableView: UITableView) -&gt; Int {
          return 1
      }
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return countryArray.count
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: flipCellId, for: indexPath) as! FlipTableViewCell
  
          //cell.textLabel?.text = countryArray[indexPath.row]
          cell.zeroLabel.text = countryArray[indexPath.row]
          cell.oneLabel.text = cityArray[indexPath.row]
  
          return cell
      }
  
      func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          UIView.transition(with: FlipTableViewCell.zeroView, duration: 0.5, options: .transitionFlipFromLeft, animations: nil, completion: nil)
  
          FlipTableViewCell.zeroView.isHidden = true
          FlipTableViewCell.oneView.isHidden = false
      }
  
      func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
          UIView.transition(with: FlipTableViewCell.oneView, duration: 0.5, options: .transitionFlipFromLeft, animations: nil, completion: nil)
  
          FlipTableViewCell.zeroView.isHidden = false
          FlipTableViewCell.oneView.isHidden = true
      }
  
      func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -&gt; CGFloat {
          return self.flipTableView.frame.width / 4
      }
  }
  </code></pre>
  
  <p><strong>TableViewCell</strong></p>
  
  <pre><code>import UIKit
  
  class FlipTableViewCell: UITableViewCell{
      override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
          super.init(style: style, reuseIdentifier: reuseIdentifier)
  
          setupView()
      }
  
      required init?(coder aDecoder: NSCoder) {
          fatalError("init(coder:) has not been implemented")
      }
  
      static let zeroView = flipView(myColor: .yellow)
      static let oneView = flipView(myColor: .green)
  
      static func flipView(myColor: UIColor) -&gt; UIView {
          let view = UIView()
          view.backgroundColor = myColor
  
          return view
      }
  
      let zeroLabel: UILabel = {
          let lb = UILabel()
          lb.text = "Zero 0"
          return lb
      }()
  
      let oneLabel: UILabel = {
          let lb = UILabel()
          lb.text = "one 1"
          return lb
      }()
  
      func setupView(){
          FlipTableViewCell.zeroView.frame = CGRect(x: 0, y: 0, width: frame.width, height:frame.height)
          FlipTableViewCell.oneView.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)
  
          self.addSubview(FlipTableViewCell.zeroView)
          self.addSubview(FlipTableViewCell.oneView)
  
          zeroLabel.frame = CGRect(x: 20, y: 0, width: self.frame.width - 40, height: 50)
          oneLabel.frame = CGRect(x: 20, y:0, width: self.frame.width - 40, height: 50)
  
          addSubview(zeroLabel)
          addSubview(oneLabel)
      }
  }
  </code></pre>