什么是reloadData函数? [英] what is reloadData function?

查看:53
本文介绍了什么是reloadData函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每一个人.我是iPhone新手.

every one. I'm a new for iphone.

我看到了一些有关iPhone开发的文档,但是我不明白[xxx reloadData];还没有tableView.

I saw some document for iphone develop, but I don't understand the [xxx reloadData]; with tableView yet.

当我使用这种方法时,我所有的单元格都被清除了.发生什么事了?

When i use this method, my all cells are cleared. What happened?

我不明白.

推荐答案

这意味着您强制 UITableView 获取数据并刷新自身.这是您更改数据源中的某些内容后想要做的事情.

It means you force the UITableView to get the data and refresh itself. It is what you wanna do after you changed something in your data source.

例如,我有一个由三个对象a,b和c组成的 NSMutableArray .我有一个删除对象的按钮,例如b.在按下按钮并从数组中删除对象b之后,除非调用 [myTableViewName reloadData] 强制其刷新,否则不会重新加载表视图.

For example, I have a NSMutableArray of three objects a, b and c. I have a button to delete an object, say b. After I pressed my button and get object b deleted from my array, my table view won't reload unless I call [myTableViewName reloadData] to force it refresh itself.

如果执行 [xxx reloadData] 后,您一无所获.这意味着,表视图所需的数据不再存在.因此,请跟踪数据源并查看数据是否已更改.

If after you do [xxx reloadData], you got nothing. It means, your data needed for the table view is not there anymore. So track the data source and see if the data got changed.

这篇关于什么是reloadData函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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