title: Static tableview How do I make the last visible row to occupy remaining space in
body: <p>There are 5 static cells. When I show all 5 cells, it's fine but If I hide some cell by returning height as zero and the last visible cell is not same as last cell of tableview in storyboard then confusion comes as to how to do that ?</p>
  <pre><code>   override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -&gt; CGFloat {
          return hideRow(at: indexPath) ? 0: UITableView.automaticDimension
      }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/v46I5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v46I5.png" alt="enter image description here" /></a></p>
  <p>IMO , If last visible row in tableview and lastrow in tableview is same</p>
  <pre><code> return indexPath.row == 4 ? 150 : tblHeight - 150
  
   override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -&gt; CGFloat {
               if hideRow(at: indexPath) {
                 return 0 
               }
               else {
                 let tblHeight = infoTable.bounds.size.height
                  if indexPath.row == 4 {
                    return tblHeight - yPlusHeightOfPreviousCell
                  }
                 return UITableView.automaticDimension
               }
         }
  </code></pre>
  <p>But the problem now what if 3rd is last row and for 4th and 5th I'm returning 0 as height to hide it.</p>
  <p>Then how to make the last visible cell expand and occupy the full space</p>