如何在UITableView中隐藏空行并根据非空行更改Uitableview的高度 [英] how to hide empty rows in a UITableView and change the height of the Uitableview based on non-empty rows

查看:159
本文介绍了如何在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.

这篇关于如何在UITableView中隐藏空行并根据非空行更改Uitableview的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆