public override void ViewDidDisappear(bool animated) { base.ViewDidDisappear(animated); if (BackgroundImageView != null) { BackgroundImageView.RemoveFromSuperview(); BackgroundImageView.Dispose(); BackgroundImageView = null; } if (LogoImageView != null) { LogoImageView.RemoveFromSuperview(); LogoImageView.Dispose(); LogoImageView = null; } if (loadingOverlay != null) { loadingOverlay.Hide(); loadingOverlay = null; //loadingOverlay.Dispose(); } //classifications.Clear(); //CollectionView.ReloadData(); //CollectionView.DataSource = null; }
public void LoadBackgroundImages() { if (BackgroundImageView != null) { BackgroundImageView.RemoveFromSuperview(); BackgroundImageView.Dispose(); BackgroundImageView = null; } if (LogoImageView != null) { LogoImageView.RemoveFromSuperview(); LogoImageView.Dispose(); LogoImageView = null; } Random rnd = new Random(); var randomDouble = (int)(rnd.NextDouble() * 10) - 1; if (randomDouble < 0 || randomDouble > 9) { randomDouble = 0; } var imageName = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? "tablet_back" : "background"; //var sourceImage = HelperMethods.GetImageFromCacheOrDefault(AppDelegate.FirstAd.ImageURL); var sourceImage = UIImage.FromBundle(imageName + randomDouble + ".png"); var resizedImage = sourceImage.ScaleImageToPreventHorizontalWhiteSpace(View.Frame.Size.Width); BackgroundImageView = new UIImageView(resizedImage); BackgroundImageView.ContentMode = UIViewContentMode.ScaleAspectFit; var extraYForNewFrameBelowNavBar = UIApplication.SharedApplication.StatusBarFrame.Height + NavigationController.NavigationBar.Bounds.Height; var currentFrame = BackgroundImageView.Frame; BackgroundImageView.Frame = new CoreGraphics.CGRect(currentFrame.X, currentFrame.Y + extraYForNewFrameBelowNavBar, currentFrame.Width, currentFrame.Height); //this.CollectionView.Add(BackgroundImageView); this.CollectionView.BackgroundView = BackgroundImageView; var logoImage = UIImage.FromBundle("home_logo.png"); var resizedLogoImage = logoImage.ScaleImageToPreventHorizontalWhiteSpace(View.Frame.Size.Width * .8f); LogoImageView = new UIImageView(resizedLogoImage); LogoImageView.ContentMode = UIViewContentMode.ScaleAspectFit; var currentLogoFrame = LogoImageView.Frame; LogoImageView.Frame = new CoreGraphics.CGRect((View.Bounds.Width - currentLogoFrame.Width) / 2, View.Bounds.Height * (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? .525 : .6), currentLogoFrame.Width, currentLogoFrame.Height); this.View.Add(LogoImageView); //View.SendSubviewToBack(LogoImageView); this.CollectionView.BackgroundColor = UIColor.White.ColorWithAlpha(.8f); //this.View.BringSubviewToFront(this.CollectionView); classifications = new List <IClassification>(); if (!Settings.IsRegistered) { classifications.Add(new Amphibian()); classifications.Add(new Commercial()); classifications.Add(new Experimental()); classifications.Add(new Helicopter()); classifications.Add(new LightSport()); classifications.Add(new Jet()); classifications.Add(new SingleEngine()); classifications.Add(new PCL.Single()); classifications.Add(new TwinPiston()); classifications.Add(new TwinTurbine()); classifications.Add(new Vintage()); classifications.Add(new Warbird()); } else { if (Settings.IsAmphibian) { classifications.Add(new Amphibian()); } if (Settings.IsCommercial) { classifications.Add(new Commercial()); } if (Settings.IsExperimental) { classifications.Add(new Experimental()); } if (Settings.IsHelicopter) { classifications.Add(new Helicopter()); } if (Settings.IsLightSport) { classifications.Add(new LightSport()); } if (Settings.IsJets) { classifications.Add(new Jet()); } if (Settings.IsSingleEngine) { classifications.Add(new SingleEngine()); } if (Settings.IsSingles) { classifications.Add(new PCL.Single()); } if (Settings.IsTwinPistons) { classifications.Add(new TwinPiston()); } if (Settings.IsTwinTurbines) { classifications.Add(new TwinTurbine()); } if (Settings.IsVintage) { classifications.Add(new Vintage()); } if (Settings.IsWarbirds) { classifications.Add(new Warbird()); } } }