views:

44

answers:

2

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.

A: 

Try [tableView reloadData]

Gary
A: 

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).

Eiko
Thank you for your help.Firstly I tested [myTableView reloadData] and nothing happend...I don't understand what you mean in the last sentence: "make sure to call on the main thread (in case your timer fires on another thread)"Could you please help me with some code ?Thank you again.
kassar
If you are starting another thread vor that 300 seconds wait, then you need to make sure to make UI updates are executed on the main thread, i.e. use -performSelectorOnMainThread. It would be easier to help if you could slim down your code to a (nonworking) minimum and post this.
Eiko
Thank you for your help,but could you please tell me where I should invoke -performSelectorOnMainThread in my code.Thank you again.
kassar