title: How to show UITableView below a UITextField using swift programmatically?
body: <p>So I have this <code>UITextField</code> and I want to show a <code>UITableView</code> just below it. I'm trying to show the suggestions in the <code>UITableView</code> my logic works fine but I want to know how can I show the <code>UITableView</code> beneath the <code>UITextField</code>.</p>
  <p>Currently, I'm doing something like this</p>
  <pre><code> private func setUpAutoCompleteTable() {
          autocompleteTableView = UITableView(frame: CGRect(x: self.originTextField.bounds.minX,y: self.originTextField.bounds.maxY,width: self.originTextField.bounds.width,height: self.originTextField.bounds.height * 4), style: UITableView.Style.plain)
          self.view.addSubview(autocompleteTableView)
          
          autocompleteTableView.delegate = self
          autocompleteTableView.dataSource = self
          autocompleteTableView.isScrollEnabled = true
          autocompleteTableView.isHidden = true
          autocompleteTableView.register(LocationAutoCompleteCell.self, forCellReuseIdentifier: &quot;AutoCompleteRowIdentifier&quot;)
      }
  </code></pre>
  <p>But it is showing the table at the top of the screen. I want to tell you that <code>originTextField</code> is inside another view.</p>
  <p><strong>UPDATE</strong></p>
  <p>This is how the view hierarchy looks.</p>
  <p><a href="https://i.stack.imgur.com/69pOy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/69pOy.png" alt="" /></a></p>