Esempio n. 1
0
        void AddCardAndPreviewTab(List <NSLayoutConstraint> constraints)
        {
            previewTab = AddPreviewTab();
            previewTab.TranslatesAutoresizingMaskIntoConstraints = false;

            PreviewLabel previewLabel = AddPreviewLabel();

            previewLabel.TranslatesAutoresizingMaskIntoConstraints = false;

            CardView cardView = AddCardView();

            cardView.TranslatesAutoresizingMaskIntoConstraints = false;

            // Pin the tab to the bottom center of the screen
            cardRevealConstraint = NSLayoutConstraint.Create(previewTab, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1f, 0f);
            constraints.Add(cardRevealConstraint);
            constraints.Add(NSLayoutConstraint.Create(previewTab, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1f, 0f));
            // Center the preview label within the tab
            constraints.Add(NSLayoutConstraint.Create(previewLabel, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, previewTab, NSLayoutAttribute.Leading, 1f, PreviewTabHorizontalPadding));
            constraints.Add(NSLayoutConstraint.Create(previewLabel, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, previewTab, NSLayoutAttribute.Trailing, 1f, -PreviewTabHorizontalPadding));
            constraints.Add(NSLayoutConstraint.Create(previewLabel, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, previewTab, NSLayoutAttribute.CenterY, 1f, 0f));

            // Pin the top of the card to the bottom of the tab
            constraints.Add(NSLayoutConstraint.Create(cardView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, previewTab, NSLayoutAttribute.Bottom, 1f, 0f));
            constraints.Add(NSLayoutConstraint.Create(cardView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, previewTab, NSLayoutAttribute.CenterX, 1f, 0f));

            // Ensure that the card fits within the view
            constraints.Add(NSLayoutConstraint.Create(cardView, NSLayoutAttribute.Width, NSLayoutRelation.LessThanOrEqual, View, NSLayoutAttribute.Width, 1f, 0f));
        }
Esempio n. 2
0
        PreviewLabel AddPreviewLabel()
        {
            PreviewLabel previewLabel = new PreviewLabel();

            previewLabel.ActivatePreviewLabel += DidActivatePreviewLabel;
            View.AddSubview(previewLabel);

            return(previewLabel);
        }
		private PreviewLabel AddPreviewLabel()
		{
			PreviewLabel previewLabel = new PreviewLabel();
			previewLabel.ActivatePreviewLabel += DidActivatePreviewLabel;
			View.AddSubview(previewLabel);

			return previewLabel;
		}