kassar
kassar

Reputation: 191

Refresh data in UITableView

I have a UITableView and I charged it with data in viewDidAppear. and it run successfully.

The Problem is I should refresh the data of the UITableView frequently (every 300 seconds). So I defined a timer and charged the UITableView's dataSource when the timer throws the event of finishing time interval (300 secs). BUT Nothing change !!! The data stills as it was.

Any help would be appreciated.

Sorry for my english.

Upvotes: 5

Views: 8249

Answers (2)

Eiko
Eiko

Reputation: 25632

You don't fill the data actively, you just implement the data source delegates.

If the data has changed, use [yourTableView reloadData] to refresh, the table will fetch the data it needs. There are methods for reloading sections or a couple of rows, too, if you know what changed and want to animate this.

Also, make sure to call on the main thread (in case your timer fires on another thread).

Upvotes: 2

Gary
Gary

Reputation: 5732

Try [tableView reloadData]

Upvotes: 7

Related Questions