Exemplo n.º 1
0
		public HelpView (RectangleF frame): base(frame)
		{
			BackgroundColor = UIColor.Clear;
			Layer.CornerRadius = 8;

			var closeFrame = new RectangleF (20, frame.Size.Height - 140, 80, 80);
			var closeView = new SymbolMarkView (closeFrame);
			closeView.TouchUpInside += async (s, e) => await Hide ();
			AddSubview (closeView);
			closeView.Symbol = "X";
			closeView.AccessibilityLabel = "Close";

			var label = new UILabel (new RectangleF (0, 20, frame.Size.Width, 40));
			label.Font = UIFont.FromName ("HelveticaNeue-Italic", 82);
			label.Text = "NSZombieApocalypse";
			label.BackgroundColor = UIColor.Clear;
			label.TextAlignment = UITextAlignment.Center;
			label.SizeToFit ();
			var labelFrame = label.Frame;
			labelFrame.X = (frame.Size.Width - labelFrame.Size.Width) / 2; 
			label.Frame = labelFrame;
			AddSubview (label);
			label.AccessibilityTraits = UIAccessibilityTrait.Header;

			var nextFrame = new RectangleF (frame.Size.Width - 100, frame.Size.Height - 140, 80, 80);
			nextButton = new SymbolMarkView (nextFrame);
			nextButton.TouchUpInside += (s, e) => NextSlide ();
			AddSubview (nextButton);
			nextButton.Symbol = "->";
			nextButton.AccessibilityLabel = "Next";

			float width = frame.Size.Width * 0.6f;
			var textViewFrame = new RectangleF (
				200 + ((frame.Size.Width - 200) - width) / 2, 
				label.Frame.GetMaxY () + 30, 
				width,
				frame.Size.Height * 0.6f
			);
			textView = new UITextView (textViewFrame.Integral ());
			AddSubview (textView);
			textView.Editable = false;
			textView.Font = UIFont.FromName ("HelveticaNeue", 36);
			textView.Text = NSBundle.MainBundle.LocalizedString ("helpText1", null, "Strings");

			var imageView = new UIImageView (UIImage.FromBundle ("smaller-zombie1.png"));
			var imageFrame = new RectangleF (label.Frame.X - 20, textViewFrame.Y, imageView.Frame.Width, imageView.Frame.Height);
			imageView.Frame = imageFrame;
			AddSubview (imageView);

			imageView.IsAccessibilityElement = true;
			imageView.AccessibilityLabel = "Poorly drawn, yet oddly menancing, zombie";

		}
Exemplo n.º 2
0
		public override void LayoutSubviews ()
		{
			RectangleF frame = Bounds;
			var newFrame = new RectangleF (Bounds.X, frame.Size.Height - 20, Bounds.Width, 20);
			labelView.Frame = newFrame.Integral ();
			RectangleF imageFrame = imageView.Frame;
			imageFrame.X = (newFrame.Size.Width - imageFrame.Size.Width) / 2;
			imageView.Frame = imageFrame.Integral ();
		}
		public override void LayoutSubviews ()
		{

			UIView[] subviews = this.Subviews;
			int count = 0;
			RectangleF bounds = Bounds;
			SizeF buttonSize = ButtonView.ButtonSize;
			float xPad = (bounds.Size.Width - (buttonSize.Width * 3)) / 4;
			float yPad = (bounds.Size.Height - (buttonSize.Height * 2)) / 3;
			float x = xPad, y = 5;
			foreach (var subview in subviews) {
				if (count > 0 && count % 3 == 0) {
					x = xPad;
					y += buttonSize.Height + yPad;
				}
				count++;
			
				var frame = new RectangleF (x, y, buttonSize.Width, buttonSize.Height);
				subview.Frame = frame.Integral ();
				x += buttonSize.Width + xPad;

			}

		}