// Run from main thread. private void HideActivityIndicator() { lock (this) { if (LoadingOverlay != null) { LoadingOverlay.RemoveFromSuperview(); LoadingOverlay = null; } } }
// Run from main thread. private void ShowActivityIndicator() { var bounds = UIScreen.MainScreen.Bounds; // show the loading overlay on the UI thread using the correct orientation sizing lock (this) { LoadingOverlay = new LoadingOverlay(bounds); View.Add(LoadingOverlay); } }