title: How to enlarge tableView on scroll?
body: <p>I'm sorry if this is a duplicate. I tried to review similar questions in SO - still doesn't quite make me understand how to deal with this.</p>
  
  <p>I have a tableView, three textViews and a UIButton. When the user scrolls the tableView, the tableView should pushes the textFields and the button out the image and take up more space. When that is done I want to continue scrolling through the cells.</p>
  
  <p>(I want one of the textFields to always remain and still show the title.) </p>
  
  <p>I think I need to put the textViews and button above the tableView inside a tableView header after which I need to set certain constraints between the UIView above the tableView and tableView itself.  Then I need to play around with the UIScrollViewDelegate and calculate something.</p>
  
  <p>As you guys can probably tell, I'm relatively new in programming and I believe this i why I don't quite understand the related questions. And as you can probably tell too, why I am pretty damn confused about how to solve my problem! </p>
  
  <p>Here's a photo of the VC: 
  <a href="https://i.stack.imgur.com/FxIlj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FxIlj.png" alt="My-VC"></a></p>
  
  <p>I wan't the tableView to go and cover the 'AddNewPersonBtn' and the two bottom textView - leaving only the top textView, the navigationBar and the tableView on the screen. --> Until you then scroll down again and the rest will be visible again. </p>
  
  <p>And here goes the code for the VC:</p>
  
  <pre><code>import UIKit
  import RealmSwift
  
  class AllPersonsInYourDiary: UIViewController, UITableViewDelegate, UITableViewDataSource {
  
  var diary: Diaries?
  
  @IBOutlet weak var tableView: UITableView!
  @IBOutlet weak var showingDiaryName: UILabel!
  @IBOutlet weak var showingDiaryQuestion: UILabel!
  @IBOutlet weak var showingExtraIdentifer: UILabel!
  @IBOutlet weak var diaryTheme: UIImageView!
  @IBOutlet weak var diaryPhoto: UIImageView!
  
  override func viewDidLoad() {
      super.viewDidLoad()
      self.tableView.tableFooterView = UIView()
      self.tableView.tableHeaderView = UIView()
  }
  
  override func viewWillAppear(_ animated: Bool) {
      tableView.reloadData()
      showDiaryIdentifiers()
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
  }
  
  @IBAction func createNewPersonButton () {
      let controller = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier:
          "PersonViewController") as! PersonViewController
      controller.mode = .create
      controller.diary = diary
      self.navigationController?.pushViewController(controller, animated: true)
  }
  
  @IBAction func showEditFunc () {
      let controller = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SettingsVC") as! SettingsVC
      controller.diary = diary
      self.navigationController?.pushViewController(controller, animated: true)
  }
  
  func showDiaryIdentifiers () {
      self.showingDiaryName.text = diary?.diaryName
      self.showingDiaryQuestion.text = diary?.diaryQuestion
      self.showingExtraIdentifer.text = diary?.diaryExtraIdentifier
      self.diaryTheme.image = UIImage(data: diary?.diaryTheme ?? Data()) ?? UIImage(named: "Blank")
      // self.diaryPhoto.image = UIImage(data: diary?.diaryPhoto ?? Data ()) ?? UIImage(named: "Blank")
  }
  
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return diary!.people.count
  }
  
  func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -&gt; CGFloat {
      return 100
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "Person1", for: indexPath) as! PersonCell
      let date = DateFormatter.localizedString(from: (diary?.people[indexPath.row].dateCreated)!, dateStyle: .short, timeStyle: .none)
  
      cell.personName.text = diary?.people[indexPath.row].name
      cell.personAnswer.text = date
      cell.personPhoto.image = UIImage(data: diary?.people[indexPath.row].photo ?? Data()) ?? UIImage(named: "PortaitPhoto")
  
      return cell
  }
  
  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      let controller = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier:
          "PersonViewController") as! PersonViewController
  
      controller.person = diary?.people[indexPath.row]
      controller.diary = diary
      controller.mode = .show
      self.navigationController?.pushViewController(controller, animated: true)
  }
  
  func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
      if editingStyle == .delete {
          let alert = UIAlertController(title: "Are you sure you wish to delete person?", message: "", preferredStyle: .alert)
          let action = UIAlertAction(title: "No thanks!", style: .cancel)
          let action1 = UIAlertAction(title: "Delete!", style: .destructive, handler: { _ in
          let realm = try! Realm()
          try! realm.write {
              guard let person = self.diary?.people[indexPath.row] else {
                  return
              }
              self.diary!.people.remove(at: indexPath.row)
              realm.delete(person)
          }
          tableView.deleteRows(at: [indexPath], with: .fade)
      })
          alert.addAction(action)
          alert.addAction(action1)
          present(alert, animated: true)
  } } 
    }
  </code></pre>