Objective-c – Dynamically Changing UITableView’s Contents


I have an NSURL object which gets data from my site, based on a variable entered by the user into the search bar.

I split this data into an NSArray.

Once I have done that I wish to display the data in a UITableView.

My question is this. Is it possible to load the data into a UITableView dynamically?

i.e. Program loads, no data so UITableView is empty, then the user searches for one variable. Gets some data and the contents is loaded into the UITableView. Searches for a new variable, old data is cleared from UITableView and the new data is added?

I'm currently trying to do this using interface builder, but fear that I may have to make my interface pragmatically, so that I could destroy and re-create the UITableView, but i'm, not sure.

Thanks for any help.

Best Solution

Sure the method reloadData on UITableView will do the trick