更新iPhone上的表格单元格中的值 [英] Update value in table cell on iPhone

查看:102
本文介绍了更新iPhone上的表格单元格中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在一个包含很多行的iPhone应用程序中有一个tableView设置,我该如何只更新其中一行?我知道他们在进入视图时手动刷新,但我想推出更新,为了争论计时器倒计时。

If I have a tableView setup in an iPhone application with many rows, how can I update just one of those rows? I'm aware that they manually refresh as they come into view, but I'm looking to push out an update, for the sake of argument a timer counting down.

谢谢

推荐答案

感谢您的回答,我找到了另一种方法!

Thanks for the answers, I found another method though!

通过调用:

NSIndexPath *a = [NSIndexPath indexPathForRow:0 inSection:0]; // I wanted to update this cell specifically
CustomTableViewCell *c = (CustomTableViewCell *)[theTableView cellForRowAtIndexPath:a];

然后我可以直接修改存储在CustomTableViewCell中的标签,如下所示:

I could then directly modify the label stored in my CustomTableViewCell, like so:

[c nowPlayingTrack].text = ...

希望有一天能帮助其他人!

Hope this helps someone else one day!

我不知道为什么但只是在tableView上调用reloadData导致运行时错误,因为自定义标签。 :(

I'm not sure why but just calling reloadData on the tableView was causing run time errors because of the custom label. :(

这篇关于更新iPhone上的表格单元格中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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