CameraViewController.Views.PermissionsView.LayoutSubviews C# (CSharp) Method

LayoutSubviews() public method

public LayoutSubviews ( ) : void
return void
		public override void LayoutSubviews()
		{
			base.LayoutSubviews();

			var size = Frame.Size;
			var maxLabelWidth = size.Width - horizontalPadding * 2;

			var iconSize = iconView.Image.Size;
			var titleSize = titleLabel.SizeThatFits(new CoreGraphics.CGSize(maxLabelWidth, float.MaxValue));
			var descriptionSize = descriptionLabel.SizeThatFits(new CoreGraphics.CGSize(maxLabelWidth, float.MaxValue));
			var settingsSize = settingsButton.SizeThatFits(new CoreGraphics.CGSize(maxLabelWidth, float.MaxValue));

			var iconX = size.Width / 2 - iconSize.Width / 2;
			var iconY = size.Height/2 - (iconSize.Height + verticalSpacing + verticalSpacing + titleSize.Height + verticalSpacing + descriptionSize.Height)/2;

			iconView.Frame = new CoreGraphics.CGRect(iconX, iconY, iconSize.Width, iconSize.Height);

			var titleX = size.Width / 2 - titleSize.Width / 2;
			var titleY = iconY + iconSize.Height + verticalSpacing + verticalSpacing;

			titleLabel.Frame = new CoreGraphics.CGRect(titleX, titleY, titleSize.Width, titleSize.Height);

			var descriptionX = size.Width / 2 - descriptionSize.Width / 2;
			var descriptionY = titleY + titleSize.Height + verticalSpacing;

			descriptionLabel.Frame = new CoreGraphics.CGRect(descriptionX, descriptionY, descriptionSize.Width, descriptionSize.Height);

			var settingsX = size.Width / 2 - settingsSize.Width / 2;
			var settingsY = descriptionY + descriptionSize.Height + verticalSpacing;

			settingsButton.Frame = new CoreGraphics.CGRect(settingsX, settingsY, settingsSize.Width, settingsSize.Height);
		}
	}