There is a navigationViewController and it's the subclass of UITableViewController
@interface TodoViewController : UITableViewController
The rightBarButtonItem is called "Reload" and it will can the function to reload data from the
WebService:
UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Reload"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(reloadTableData)];
rightBarButtonItem.tintColor = [UIColor colorWithRed:0.41176f green:0.41176f blue:0.41176f alpha:1.0];
self.navigationItem.rightBarButtonItem = rightBarButtonItem;
and there is my reload function:
- (void)reloadTableData
{
[self.allTodoArray removeAllObjects];
self.pageIndex = 1;
[self getTodoList:self.pageIndex sortTpye:self.sortType];
[self.tableView reloadData];
}
The getTodoList() function will return the new data from the remote WebService, and the
value is not nil.
My question is : when I click the reload button to request the new data of this UITableView
the tableView is empty... I dont know how to make it OK!
Help me with this, thank you in advance!
You will need to reload the table view data asynchronously. Create a callback or block to reload the tableview when the WebService api call completes.