I have UITableView
controller with a sync button at the right of the nav bar. When the user gets to this screen for the first time, the table is empty. When I click the sync button, I would like to:
call my function to get new data
reload the data in the view immediately (don't have to go back or to another view for this to refresh)
Right now, it appears as if nothing happens to the table unless I go back a screen, and then come back. Here is my code:
public override viewdidload(){
base.viewdidload();
MyTable.Source = new MyListSource (items, this);
this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Action, syncMe), true);
}
public async void syncMe(){
await getData();
MyTable.ReloadData();
}
Try this:
public override viewdidload()
{
base.viewdidload();
MyTable.Source = new MyListSource (items, this);
this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Action, syncMe), true);
}
public async void syncMe()
{
items = await getData();
MyTable.Source = new MyListSource (items, this);
MyTable.ReloadData();
}