I want to add a refresh button in UINavigationBar that refreshes the entire table contents. Nothing happens when i click on the refresh button.
I searched google and found that reloadData method refreshes the tableview so I tried using it.
I want to add a refresh button in UINavigationBar that refreshes the entire table
Share
-[UITableView reloadData]tells the table view to request again from you the number of rows in the table, and the cells at each section and row. It’s up to you to update your internal data structures as appropriate. So in this case, yourIBActionshould call your own method to refetch the data from the server.A few other notes:
-initWithContentsOfURL:is blocking. This can hang your program for a long time. You should be using asynchronous fetching here (generally withNSURLConnection).