如何在UITableView中隐藏空行并根据非空行更改Uitableview的高度

问题描述:

我的 UITableView 有几个问题。


  1. 当我在我的页面上添加 UITableview 时,默认情况下它会显示一些固定数量的行,
    即使我将部分中的行数设置为 1 。除第一行外,所有行都显示,都是空行。所以,我想隐藏 UItableview 中的所有空行。

  1. When I add a UITableview on my page, by default it brings up some fixed number of rows, even though I set number of rows in section as 1. All the rows appear except the first row, and all are empty rows. So, I want to hide all the empty rows in the UItableview.

基于非空行,我想更改 UItableView 的高度。

Based on the non-empty rows, I want to change the height of my UItableView.


您确定使用的是 UITableViewStyleGrouped 样式?

因为默认情况下它设置为 UITableViewStylePlain ,它在显示后也会显示空单元格填充细胞。

Because by default it is set to UITableViewStylePlain which shows empty cells too after displaying filled cells.