Search code examples
xamarin.iosloadingpushviewcontroller

Monotouch: How do I show a loading animation whilst waiting for the next UIViewController to load?


I have a UITableView and on RowSelected i want to show a loading animation and then load another ViewController:

public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
   LoadingView LV = new LoadingView();

   LV.Show("Loading...");


   specScreen = new SpecScreen();

   controller.NavigationController.PushViewController(specScreen, true);

   LV.Hide();
}

However the loading animation only appears for a split second AFTER the next viewcontroller has loaded.

How do I show the Loading animation and then wait for the next view controller to load and hide it again?


Solution

  • Tanis, make LoadingView singleton and place LoadingView.Instance.Hide(); to ViewDidAppear in SpecScreen viewcontroller.