UITableView 设置为静态单元格.是否可以以编程方式隐藏某些单元格? [英] UITableView set to static cells. Is it possible to hide some of the cells programmatically?

查看:36
本文介绍了UITableView 设置为静态单元格.是否可以以编程方式隐藏某些单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UITableView 设置为静态单元格.

是否可以通过编程方式隐藏某些单元格?

Is it possible to hide some of the cells programmatically?

推荐答案

您正在寻找此解决方案:

You are looking for this solution :

静态数据表视图控制器 2.0

https://github.com/xelvenone/StaticDataTableViewController

它可以显示/隐藏/重新加载任何带有或不带有动画的静态单元格!

which can show/hide/reload any static cell(s) with or without animation!

[self cell:self.outletToMyStaticCell1 setHidden:hide]; 
[self cell:self.outletToMyStaticCell2 setHidden:hide]; 
[self reloadDataAnimated:YES];

请注意始终只使用 (reloadDataAnimated:YES/NO)(不要直接调用[self.tableView reloadData])

Note to always use only (reloadDataAnimated:YES/NO) (dont call [self.tableView reloadData] directly)

这不使用将高度设置为 0 的 hacky 解决方案,并允许您为更改设置动画并隐藏整个部分

这篇关于UITableView 设置为静态单元格.是否可以以编程方式隐藏某些单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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