Exemple #1
0
		public override void LoadView ()
		{
			base.LoadView ();
			
			if (_backgroundImage != null) {
				/*
				this.imageView = new UIImageView (bgImage);
				this.imageView.Frame = new RectangleF (0, 0, this.View.Frame.Size.Width, this.View.Frame.Size.Height);
				this.imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
				this.imageView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin |
				UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin;
				//imageView.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
				View.BackgroundColor = Resources.Colors.Background;
				View.AddSubview (imageView);
				*/
				// new code
				_backgroundView = new BackgroundView (this);
				_backgroundView.Frame = View.Frame;
				_backgroundView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
				_backgroundView.AutosizesSubviews = true;
				_backgroundView.UserInteractionEnabled = true;
				
				//Copy View from Interface designer
				if (View.Subviews != null && View.Subviews.Length > 0) {
					_backgroundView.AddSubviews (View.Subviews);
					foreach (var view in View.Subviews) {
						view.RemoveFromSuperview ();
					}
				}
				_backgroundView.ContentMode = UIViewContentMode.Redraw;

				View = _backgroundView;
				// new code
			}
		}