如何在uitableview中显示计时器?

时间:2015-01-21 02:17:40

标签: xcode uitableview uilabel nstimer

我正在尝试创建一个两个人可以互相发送消息的应用,但30秒后发送消息我想删除该消息。消息正在UITableView中显示。我有一个UILabel显示每个UITableViewCell剩余多少时间,但我想知道是否有任何方法可以做到这一点,而无需每秒调用[self.tableView reloadData]。有没有其他方法可以解决这个问题?

非常感谢,

zweg25

2 个答案:

答案 0 :(得分:0)

您可以通过调用

单独重新加载单元格
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation

http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006943-CH3-SW40

答案 1 :(得分:0)

如果您只想以编程方式删除tableview中的某些行,可以在tableview中使用此方法:

- (void) deleteRowsAtIndexPaths:(NSArray *)rows withRowAnimation:(UITableViewRowAnimation)animation

但是,在调用此方法刷新tablview之前,必须删除数据源中的项目。

希望我的回答可以帮助你:)