void Initialize()
        {
            BubbleHighlightedImage = highlightedBubbleImage;
            BubbleImage            = normalBubbleImage;

            var views = new NSMutableDictionary();

            views.Add(new NSString("bubble"), BubbleImageView);
            views.Add(new NSString("date"), DateLabel);

            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[bubble]", 0, "bubble", BubbleImageView));
            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-2-[bubble]-[date]-2-|", 0, null, views));

            BubbleImageView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[bubble(>=48)]", 0, "bubble", BubbleImageView));

            var vSpaceTop = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.Top, 1, 10);

            ContentView.AddConstraint(vSpaceTop);

            var vSpaceBottom = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.Bottom, 1, -10);

            ContentView.AddConstraint(vSpaceBottom);

            var msgLeading = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.Leading, NSLayoutRelation.GreaterThanOrEqual, BubbleImageView, NSLayoutAttribute.Leading, 1, 16);

            ContentView.AddConstraint(msgLeading);

            var msgCenter = NSLayoutConstraint.Create(MessageLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.CenterX, 1, 3);

            ContentView.AddConstraint(msgCenter);

            var vSpaceTopDate = NSLayoutConstraint.Create(DateLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.Bottom, 1, 3);

            ContentView.AddConstraint(vSpaceTopDate);

            var dateLeading = NSLayoutConstraint.Create(DateLabel, NSLayoutAttribute.Leading, NSLayoutRelation.GreaterThanOrEqual, BubbleImageView, NSLayoutAttribute.Leading, 1, 16);

            ContentView.AddConstraint(dateLeading);

            var dateCenter = NSLayoutConstraint.Create(DateLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, BubbleImageView, NSLayoutAttribute.CenterX, 1, 3);

            ContentView.AddConstraint(dateCenter);
        }
Example #2
0
        public NumericEditorControl(IHostResourceProvider hostResources)
            : base(hostResources)
        {
            base.TranslatesAutoresizingMaskIntoConstraints = false;

            NumericEditor = new NumericSpinEditor <T> (hostResources);
            NumericEditor.ValueChanged += OnValueChanged;

            var t = typeof(T);

            if (t.Name == PropertyViewModel <T> .NullableName)
            {
                this.underlyingType = Nullable.GetUnderlyingType(t);
                t = this.underlyingType;
            }
            TypeCode code = Type.GetTypeCode(t);

            switch (code)
            {
            case TypeCode.Double:
            case TypeCode.Single:
            case TypeCode.Decimal:
                NumberStyle = NSNumberFormatterStyle.Decimal;
                Formatter.UsesGroupingSeparator = false;
                Formatter.MaximumFractionDigits = 15;
                break;

            default:
                NumberStyle = NSNumberFormatterStyle.None;
                break;
            }

            AddSubview(NumericEditor);

            this.editorRightConstraint = NSLayoutConstraint.Create(NumericEditor, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0);

            this.AddConstraints(new[] {
                NSLayoutConstraint.Create(NumericEditor, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0),
                NSLayoutConstraint.Create(NumericEditor, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1, 0),
                this.editorRightConstraint,
                NSLayoutConstraint.Create(NumericEditor, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, -6),
            });
        }
        void AddLayoutConstraints()
        {
            holderView.TranslatesAutoresizingMaskIntoConstraints      = false;
            SearchCityLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            SearchButton.TranslatesAutoresizingMaskIntoConstraints    = false;
            SearchTableView.TranslatesAutoresizingMaskIntoConstraints = false;
            ads.TranslatesAutoresizingMaskIntoConstraints             = false;

            SearchTableView.ScrollEnabled = true;
            SearchTableView.Bounces       = false;

            //Scrollview Constraints
            this.View.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(holderView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this.View, NSLayoutAttribute.Width, 1, 0),
                NSLayoutConstraint.Create(holderView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, this.View, NSLayoutAttribute.Bottom, 1, 0),
                NSLayoutConstraint.Create(holderView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this.View, NSLayoutAttribute.Top, 1, 64),
                NSLayoutConstraint.Create(holderView, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this.View, NSLayoutAttribute.Left, 1, 0),
            });
            //Search Table Constraints
            this.View.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(SearchTableView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, holderView, NSLayoutAttribute.Width, 1, 0),
                NSLayoutConstraint.Create(SearchTableView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, holderView, NSLayoutAttribute.CenterX, 1, 0),
                NSLayoutConstraint.Create(SearchTableView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, SearchButton, NSLayoutAttribute.Bottom, 1, 15),
            });
            //Search CL Label Constraints
            this.View.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(SearchCityLabel, NSLayoutAttribute.Width, NSLayoutRelation.Equal, holderView, NSLayoutAttribute.Width, 0.9f, 0),
                NSLayoutConstraint.Create(SearchCityLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, holderView, NSLayoutAttribute.CenterX, 1, 0),
                NSLayoutConstraint.Create(SearchCityLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, holderView, NSLayoutAttribute.Top, 1, 15),
            });

            //Search Button Constraints
            this.View.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(SearchButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, holderView, NSLayoutAttribute.Width, .90f, 0),
                NSLayoutConstraint.Create(SearchButton, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, holderView, NSLayoutAttribute.CenterX, 1, 0),
                NSLayoutConstraint.Create(SearchButton, NSLayoutAttribute.Top, NSLayoutRelation.Equal, SearchCityLabel, NSLayoutAttribute.Bottom, 1, 15),
                NSLayoutConstraint.Create(SearchButton, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, Constants.ButtonHeight),
            });

            AddAdBanner(false);

            this.View.LayoutIfNeeded();
        }
        public void BindDataToView(Card card, bool showNameLabel, NSIndexPath indexPath)
        {
            Reset();

            if (card == null)
            {
                return;
            }

            NameLabelHeightConstraint.Constant = (showNameLabel) ? 24 : 0;
            NameLabel.Text = card.Name;

            var cardBack = CardBack.Create();

            cardBack.BindDataToView(card, false);
            cardBack.Hidden = true;
            cardBack.Frame  = ContainerView.Bounds;
            ContainerView.AddSubview(cardBack);
            ContainerView.AddConstraint(NSLayoutConstraint.Create(cardBack, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0));
            ContainerView.AddConstraint(NSLayoutConstraint.Create(cardBack, NSLayoutAttribute.Right, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Right, 1, 0));
            ContainerView.AddConstraint(NSLayoutConstraint.Create(cardBack, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0));
            ContainerView.AddConstraint(NSLayoutConstraint.Create(cardBack, NSLayoutAttribute.Left, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Left, 1, 0));

            var cardFront = CardFront.Create();

            cardFront.BindDataToView(card, false, indexPath, true);
            cardFront.Hidden = true;
            cardFront.Frame  = ContainerView.Bounds;
            ContainerView.AddSubview(cardFront);
            ContainerView.AddConstraint(NSLayoutConstraint.Create(cardFront, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0));
            ContainerView.AddConstraint(NSLayoutConstraint.Create(cardFront, NSLayoutAttribute.Right, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Right, 1, 0));
            ContainerView.AddConstraint(NSLayoutConstraint.Create(cardFront, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0));
            ContainerView.AddConstraint(NSLayoutConstraint.Create(cardFront, NSLayoutAttribute.Left, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Left, 1, 0));

            if (card.IsFlipped)
            {
                cardBack.Hidden = false;
            }
            else
            {
                cardFront.Hidden = false;
            }
        }
Example #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            Add(tableView = new UITableView(this.View.Frame));

            tableView.TranslatesAutoresizingMaskIntoConstraints = false;
            View.AddConstraint(NSLayoutConstraint.Create(tableView, NSLayoutAttribute.Top,
                                                         NSLayoutRelation.Equal, View, NSLayoutAttribute.TopMargin, 1, 0));
            View.AddConstraint(NSLayoutConstraint.Create(tableView, NSLayoutAttribute.Left,
                                                         NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, 0));
            View.AddConstraint(NSLayoutConstraint.Create(tableView, NSLayoutAttribute.Width,
                                                         NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, 0));
            View.AddConstraint(NSLayoutConstraint.Create(tableView, NSLayoutAttribute.Height,
                                                         NSLayoutRelation.Equal, View, NSLayoutAttribute.Height, 1, 0));

            tableView.Source = dataSource = new EmailServerDataSource(this);
        }
Example #6
0
        private static UITableViewCell CreateTableViewCell()
        {
            var cell      = new UITableViewCell {
            };
            var imageView = new UIImageView {
                ContentMode = UIViewContentMode.Center, TranslatesAutoresizingMaskIntoConstraints = false
            };

            cell.ContentView.AddSubview(imageView);
            cell.ContentView.AddConstraints(new[]
            {
                NSLayoutConstraint.Create(imageView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, cell.ContentView, NSLayoutAttribute.Leading, 1, 0),
                NSLayoutConstraint.Create(imageView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, cell.ContentView, NSLayoutAttribute.Trailing, 1, 0),
                NSLayoutConstraint.Create(imageView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, cell.ContentView, NSLayoutAttribute.CenterY, 1, 0),
                NSLayoutConstraint.Create(imageView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 30),
            });

            return(cell);
        }
 /// <summary>
 /// Sets the left constraint of the current view to the right of the view within the given constraint container.
 /// Any margin of the given view and the current view will be added (no margin collapse).
 /// </summary>
 /// <returns>The of.</returns>
 /// <param name="container">Container.</param>
 /// <param name="margin">Margin.</param>
 /// <param name="priority">Constraint priority.</param>
 public ConstraintHelper LeftOf(ConstraintContainer container, float?margin = null, float?priority = null)
 {
     if (margin != null)
     {
         _currentItem.Margin.Left = (float)margin;
     }
     _currentItem.ConstraintLeft = NSLayoutConstraint.Create(
         _currentItem.View, NSLayoutAttribute.Left,
         NSLayoutRelation.Equal,
         container.View, NSLayoutAttribute.Right,
         1f, _currentItem.Margin.Left + container.Margin.Right
         );
     if (priority != null)
     {
         _currentItem.ConstraintLeft.Priority = (float)priority;
     }
     _view.AddConstraint(_currentItem.ConstraintLeft);
     return(this);
 }
        void AddStepsMessage()
        {
            stepsMessage = new UILabel(RectangleF.Empty);
            stepsMessage.TranslatesAutoresizingMaskIntoConstraints = false;
            stepsMessage.Lines = 0;
            stepsMessage.Font  = UIFont.SystemFontOfSize(UIFont.SmallSystemFontSize);

            this.View.AddSubview(stepsMessage);

            stepsMessage.AddConstraints(new [] {
                NSLayoutConstraint.Create(stepsMessage, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 56),
                NSLayoutConstraint.Create(stepsMessage, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.Width, 1, 300),
            });

            this.View.AddConstraints(new[] {
                NSLayoutConstraint.Create(stepsMessage, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, titleLabel, NSLayoutAttribute.CenterX, 1, 0),
                NSLayoutConstraint.Create(stepsMessage, NSLayoutAttribute.Top, NSLayoutRelation.Equal, requestAccessButton, NSLayoutAttribute.Bottom, 1, 40),
            });
        }
 /// <summary>
 /// Sets the bottom constraint of the current view to the bottom of the view within the given constraint container.
 /// Any margin of the given view and the current view will be added (no margin collapse).
 /// </summary>
 /// <returns>ConstraintHelper</returns>
 /// <param name="container">Container.</param>
 /// <param name="margin">Margin.</param>
 /// <param name="priority">Constraint priority.</param>
 public ConstraintHelper AboveOf(ConstraintContainer container, float?margin = null, float?priority = null)
 {
     if (margin != null)
     {
         _currentItem.Margin.Bottom = (float)margin;
     }
     _currentItem.ConstraintBottom = NSLayoutConstraint.Create(
         _currentItem.View, NSLayoutAttribute.Bottom,
         NSLayoutRelation.Equal,
         container.View, NSLayoutAttribute.Top,
         1f, 0 - (_currentItem.Margin.Bottom + container.Margin.Top)
         );
     if (priority != null)
     {
         _currentItem.ConstraintBottom.Priority = (float)priority;
     }
     _view.AddConstraint(_currentItem.ConstraintBottom);
     return(this);
 }
Example #10
0
        void AddMap()
        {
            mapView = new MKMapView();
            mapView.TranslatesAutoresizingMaskIntoConstraints = false;

            this.View.AddSubview(mapView);

            var dict = new NSMutableDictionary();

            dict.Add((NSString)"mainView", this.View);
            dict.Add((NSString)"mapView", mapView);
            dict.Add((NSString)"locationMessage", locationMessage);

            this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[mapView]-|", NSLayoutFormatOptions.AlignAllTop, null, dict));
            this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[locationMessage]-[mapView]-|", NSLayoutFormatOptions.AlignAllCenterX, null, dict));
            this.View.AddConstraints(new[] {
                NSLayoutConstraint.Create(locationMessage, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, titleLabel, NSLayoutAttribute.CenterX, 1, 0),
            });
        }
Example #11
0
        void setupKludge()
        {
            if (this.kludge == null)
            {
                UIView kludge1 = new UIView();
                this.View.AddSubview(kludge1);
                kludge1.TranslatesAutoresizingMaskIntoConstraints = false;
                kludge1.Hidden = true;


                NSLayoutConstraint a = NSLayoutConstraint.Create(view1: kludge1, attribute1: NSLayoutAttribute.Left, relation: NSLayoutRelation.Equal, view2: this.View, attribute2: NSLayoutAttribute.Left, multiplier: 1, constant: 0);
                NSLayoutConstraint b = NSLayoutConstraint.Create(view1: kludge1, attribute1: NSLayoutAttribute.Right, relation: NSLayoutRelation.Equal, view2: this.View, attribute2: NSLayoutAttribute.Left, multiplier: 1, constant: 0);
                NSLayoutConstraint c = NSLayoutConstraint.Create(view1: kludge1, attribute1: NSLayoutAttribute.Top, relation: NSLayoutRelation.Equal, view2: this.View, attribute2: NSLayoutAttribute.Top, multiplier: 1, constant: 0);
                NSLayoutConstraint d = NSLayoutConstraint.Create(view1: kludge1, attribute1: NSLayoutAttribute.Bottom, relation: NSLayoutRelation.Equal, view2: this.View, attribute2: NSLayoutAttribute.Top, multiplier: 1, constant: 0);
                this.View.AddConstraints(new NSLayoutConstraint[] { a, b, c, d });

                this.kludge = kludge1;
            }
        }
Example #12
0
        public static NSLayoutConstraint[] FillParent(this UIView view, UIView parent, float top = 0, float left = 0, float right = 0, float bottom = 0)
        {
            var list = new NSLayoutConstraint[4];

            view.TranslatesAutoresizingMaskIntoConstraints = false;
            var topC = NSLayoutConstraint.Create(view, NSLayoutAttribute.Top, NSLayoutRelation.Equal,
                                                 parent, NSLayoutAttribute.Top, 1, top);

            var leftC = NSLayoutConstraint.Create(view, NSLayoutAttribute.Left, NSLayoutRelation.Equal, parent, NSLayoutAttribute.Left, 1, left);

            var rightC  = NSLayoutConstraint.Create(view, NSLayoutAttribute.Right, NSLayoutRelation.Equal, parent, NSLayoutAttribute.Right, 1, right);
            var bottomC = NSLayoutConstraint.Create(view, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, parent, NSLayoutAttribute.Bottom, 1, bottom);

            list[0] = topC;
            list[1] = leftC;
            list[2] = rightC;
            list[3] = bottomC;
            return(list);
        }
Example #13
0
        public EntryPropertyEditor(IHostResourceProvider hostResources)
            : base(hostResources)
        {
            Entry = new PropertyTextField {
                BackgroundColor = NSColor.Clear,
                ControlSize     = NSControlSize.Small,
                Font            = NSFont.SystemFontOfSize(NSFont.SystemFontSizeForControlSize(NSControlSize.Small)),
                TranslatesAutoresizingMaskIntoConstraints = false,
            };
            AddSubview(Entry);

            RightEdgeConstraint = NSLayoutConstraint.Create(Entry, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0);
            AddConstraints(new[] {
                NSLayoutConstraint.Create(Entry, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0),
                NSLayoutConstraint.Create(Entry, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1, 0),
                RightEdgeConstraint,
                NSLayoutConstraint.Create(Entry, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, -6),
            });
        }
Example #14
0
        private void SetupImageTableView()
        {
            ImageTableView = new UITableView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Source = CreateTableViewSource(),
            };
            ImageTableView.Layer.CornerRadius = 10f;

            View.AddSubview(ImageTableView);
            View.AddConstraints(new[]
            {
                NSLayoutConstraint.Create(ImageTableView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, View, NSLayoutAttribute.Trailing, 1, 10),
                NSLayoutConstraint.Create(ImageTableView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterY, 1, 0),
                NSLayoutConstraint.Create(ImageTableView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, 100),
                NSLayoutConstraint.Create(ImageTableView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, -100),
                NSLayoutConstraint.Create(ImageTableView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1, 60),
            });
        }
Example #15
0
        public void Initialize()
        {
            Map             = new Map();
            BackgroundColor = UIColor.White;

            _canvas.TranslatesAutoresizingMaskIntoConstraints = false;
            _canvas.MultipleTouchEnabled = true;
            _canvas.PaintSurface        += OnPaintSurface;
            AddSubview(_canvas);

            AddConstraints(new[] {
                NSLayoutConstraint.Create(this, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, _canvas, NSLayoutAttribute.Leading, 1.0f, 0.0f),
                NSLayoutConstraint.Create(this, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, _canvas, NSLayoutAttribute.Trailing, 1.0f, 0.0f),
                NSLayoutConstraint.Create(this, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _canvas, NSLayoutAttribute.Top, 1.0f, 0.0f),
                NSLayoutConstraint.Create(this, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _canvas, NSLayoutAttribute.Bottom, 1.0f, 0.0f)
            });

            // Unfortunately the SKGLView does not have a IgnorePixelScaling property. We have to adjust with _scale.
            _scale = PixelsPerDeviceIndepententUnit;

            TryInitializeViewport();

            ClipsToBounds          = true;
            MultipleTouchEnabled   = true;
            UserInteractionEnabled = true;

            var doubleTapGestureRecognizer = new UITapGestureRecognizer(OnDoubleTapped)
            {
                NumberOfTapsRequired = 2,
                CancelsTouchesInView = false,
            };

            AddGestureRecognizer(doubleTapGestureRecognizer);

            var tapGestureRecognizer = new UITapGestureRecognizer(OnSingleTapped)
            {
                NumberOfTapsRequired = 1,
                CancelsTouchesInView = false,
            };

            tapGestureRecognizer.RequireGestureRecognizerToFail(doubleTapGestureRecognizer);
            AddGestureRecognizer(tapGestureRecognizer);
        }
Example #16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AutomaticallyAdjustsScrollViewInsets = false;
            TargetViewController.AutomaticallyAdjustsScrollViewInsets = false;

            if (TargetViewController != null)
            {
                TargetViewController.View.TranslatesAutoresizingMaskIntoConstraints = false;
                AddChildViewController(TargetViewController);
                View.AddSubview(TargetViewController.View);

                View.AddConstraint(NSLayoutConstraint.Create(TargetViewController.View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, 44));
                View.AddConstraint(NSLayoutConstraint.Create(TargetViewController.View, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, 0));
                View.AddConstraint(NSLayoutConstraint.Create(TargetViewController.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, 0));
                View.AddConstraint(NSLayoutConstraint.Create(TargetViewController.View, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, 0));
            }
        }
        private void AddUI()
        {
            PlaneTrackingButton = new UIImageView {
                UserInteractionEnabled = true, TranslatesAutoresizingMaskIntoConstraints = false
            };
            PlaneTrackingButton.Image = UIImage.FromBundle("sprites/sprite238.gif");

            View.AddSubview(PlaneTrackingButton);
            View.AddConstraints(new[] {
                NSLayoutConstraint.Create(PlaneTrackingButton, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, View, NSLayoutAttribute.Leading, 1, 20),
                NSLayoutConstraint.Create(PlaneTrackingButton, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, -20),
            });

            PlaneTrackingButton.AddGestureRecognizer(new UITapGestureRecognizer(gr =>
            {
                var cfg = SCNView.Session.Configuration as ARWorldTrackingConfiguration;
                if (cfg == null)
                {
                    return; // non arkit;
                }
                var willBeEnabled  = cfg.PlaneDetection == ARPlaneDetection.None;
                cfg.PlaneDetection = willBeEnabled
                ? ARPlaneDetection.Horizontal | ARPlaneDetection.Vertical
                : ARPlaneDetection.None;

                SCNView.Session.Run(cfg);
                PlaneTrackingEnabled = willBeEnabled;
                UIView.Animate(.2, () => PlaneTrackingButton.Alpha = willBeEnabled ? 1 : .5f);
            }));

            PlaneTrackingButton.AddGestureRecognizer(new UILongPressGestureRecognizer(gr =>
            {
                if (gr.State != UIGestureRecognizerState.Began)
                {
                    return;
                }

                foreach (var node in SCNView.Scene.RootNode.ChildNodes.Where(x => x.ChildNodes.Any(y => y.Geometry as SCNPlane != null)))
                {
                    node.Opacity = node.Opacity == 0 ? 1 : 0;
                }
            }));
        }
Example #18
0
        public AttributionView()
        {
            stackView = new UIStackView();
            stackView.TranslatesAutoresizingMaskIntoConstraints = false;
            stackView.Axis         = UILayoutConstraintAxis.Vertical;
            stackView.Alignment    = UIStackViewAlignment.Fill;
            stackView.Distribution = UIStackViewDistribution.Fill;

            AddSubview(stackView);

            AddConstraints(new NSLayoutConstraint [] {
                NSLayoutConstraint.Create(this, NSLayoutAttribute.Left, NSLayoutRelation.Equal, stackView, NSLayoutAttribute.Left, 1.0f, -4.0f),
                NSLayoutConstraint.Create(this, NSLayoutAttribute.Right, NSLayoutRelation.Equal, stackView, NSLayoutAttribute.Right, 1.0f, 4.0f),
                NSLayoutConstraint.Create(this, NSLayoutAttribute.Top, NSLayoutRelation.Equal, stackView, NSLayoutAttribute.Top, 1.0f, -4.0f),
                NSLayoutConstraint.Create(this, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, stackView, NSLayoutAttribute.Bottom, 1.0f, 4.0f),
            });

            Font = UIFont.PreferredFootnote;
        }
Example #19
0
        public override void ItemTapped(SCNNode node, MeetupProfile item)
        {
            base.ItemTapped(node, item);

            var dialogController = new DisplayMeetupProfileViewController(item);
            var dialogView       = dialogController.View;

            dialogController.WillMoveToParentViewController(this);
            View.AddSubview(dialogView);
            View.AddConstraints(new[]
            {
                NSLayoutConstraint.Create(dialogView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0),
                NSLayoutConstraint.Create(dialogView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterY, 1, -100),
                NSLayoutConstraint.Create(dialogView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, View, NSLayoutAttribute.Leading, 1, 5),
            });
            dialogController.DidMoveToParentViewController(this);

            _displayedViewController = dialogController;
        }
        public void FirstLocalVideoFrameWithSize(AgoraRtcEngineKit engine, CoreGraphics.CGSize size, nint elapsed)
        {
            var    fixedSize = size.FixedSize(ContainerView.Bounds.Size);
            nfloat ratio;

            if (fixedSize.Width > 0 && fixedSize.Height > 0)
            {
                ratio = fixedSize.Width / fixedSize.Height;
            }
            else
            {
                ratio = ContainerView.Bounds.Width / ContainerView.Bounds.Height;
            }
            var viewWidth = NSLayoutConstraint.Create(LocalView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Width, 0.249999f, 0f);
            var viewRatio = NSLayoutConstraint.Create(LocalView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, LocalView, NSLayoutAttribute.Height, ratio, 0f);

            NSLayoutConstraint.DeactivateConstraints(new NSLayoutConstraint[] { LocalVideoWidth, LocalVideoHeight });
            NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { viewWidth, viewRatio });
        }
Example #21
0
            public override void LoadView()
            {
                View = new ContainerView(this);
                NativeChild.RemoveFromSuperview();
                View.AddSubview(NativeChild);

                WidgetSpacing padding = 0;

                if (Backend != null)
                {
                    padding = Backend.Frontend.Padding;
                }
                View.AddConstraints(new NSLayoutConstraint [] {
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, (nfloat)padding.Left),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, -(nfloat)padding.Right),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, (nfloat)padding.Top),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, -(nfloat)padding.Bottom),
                });
            }
Example #22
0
            public ImageCell()
            {
                SelectionStyle = UITableViewCellSelectionStyle.None;
                ContentView.BackgroundColor = UIColor.Clear;
                BackgroundColor             = UIColor.Clear;

                var contenView = new UIView {
                    Alpha           = 0.5f,
                    BackgroundColor = UIColor.Black,
                    TranslatesAutoresizingMaskIntoConstraints = false
                };

                var imageView = new UIImageView(UIImage.FromBundle("logo"))
                {
                    TranslatesAutoresizingMaskIntoConstraints = false
                };

                var closeButton = UIButton.FromType(UIButtonType.System);

                closeButton.Frame = new CoreGraphics.CGRect(20, 30, 50, 50);
                closeButton.SetTitle("x", UIControlState.Normal);
                closeButton.SetTitleColor(UIColor.White.ColorWithAlpha(0.8f), UIControlState.Normal);
                closeButton.Font = UIFont.FromName(closeButton.Font.Name, 35);
                CloseStream      = closeButton.RXTouchUpInside();

                var views = new NSDictionary("contenView", contenView, "imageView", imageView, "closeButton", closeButton);

                ContentView.Add(contenView);
                ContentView.Add(imageView);
                ContentView.Add(closeButton);

                ContentView.AddConstraint(NSLayoutConstraint.Create(contenView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.CenterX, 1f, 0f));
                ContentView.AddConstraint(NSLayoutConstraint.Create(contenView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.CenterY, 1f, 0f));
                ContentView.AddConstraint(NSLayoutConstraint.Create(contenView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Width, 1f, 0f));
                ContentView.AddConstraint(NSLayoutConstraint.Create(contenView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Height, 1f, 0f));

                ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[imageView(200)]", 0, null, views));
                ContentView.AddConstraint(NSLayoutConstraint.Create(imageView, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.CenterX, 1f, 0f));
                ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-50-[imageView(60)]-30-|", 0, null, views));

                ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-10-[closeButton]", 0, null, views));
                ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-60-[closeButton]", 0, null, views));
            }
        public AccountSwitchingOverlayView CreateAccountSwitchingOverlayView(UIView containerView)
        {
            var overlay = new AccountSwitchingOverlayView()
            {
                LongPressAccountEnabled = false,
                AfterHide = () =>
                {
                    if (containerView != null)
                    {
                        containerView.Hidden = true;
                    }
                }
            };

            var vm = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger)
            {
                FromIOSExtension = true
            };

            overlay.BindingContext = vm;
            overlay.IsVisible      = false;

            var renderer = Platform.CreateRenderer(overlay.Content);

            renderer.SetElementSize(new Size(containerView.Frame.Size.Width, containerView.Frame.Size.Height));

            var view = renderer.NativeView;

            view.TranslatesAutoresizingMaskIntoConstraints = false;

            containerView.AddSubview(view);
            containerView.AddConstraints(new NSLayoutConstraint[]
            {
                NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, view, NSLayoutAttribute.Trailing, 1f, 0f),
                NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, view, NSLayoutAttribute.Leading, 1f, 0f),
                NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, view, NSLayoutAttribute.Top, 1f, 0f),
                NSLayoutConstraint.Create(containerView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, view, NSLayoutAttribute.Bottom, 1f, 0f)
            });
            containerView.Hidden = true;

            return(overlay);
        }
        private void UpdateConstraintsForRemoval(UIView above, UIView viewBeingRemoved, UIView below)
        {
            // Remove the existing constraints that gets changed
            // The one connecting to the top gets auto-removed since the viewBeingRemoved was removed
            // Same as the one connecting to below

            if (above != null && below != null)
            {
                View.AddConstraint(NSLayoutConstraint.Create(
                                       below,
                                       NSLayoutAttribute.Top,
                                       NSLayoutRelation.Equal,
                                       above,
                                       NSLayoutAttribute.Bottom,
                                       1,
                                       0));
            }
            else if (above != null)
            {
                // If this is the last view we need to pin it to bottom
                View.AddConstraint(NSLayoutConstraint.Create(
                                       above,
                                       NSLayoutAttribute.Bottom,
                                       NSLayoutRelation.Equal,
                                       View,
                                       NSLayoutAttribute.Bottom,
                                       1,
                                       0));
            }
            else if (below != null)
            {
                // Pin to top of view
                View.AddConstraint(NSLayoutConstraint.Create(
                                       below,
                                       NSLayoutAttribute.Top,
                                       NSLayoutRelation.Equal,
                                       View,
                                       NSLayoutAttribute.Top,
                                       1,
                                       0));
            }
        }
Example #25
0
        UIAlertController CreateAlert(UITextField uITextField)
        {
            var paddingTitle = 0;

            if (!string.IsNullOrEmpty(VirtualView.Title))
            {
                paddingTitle += 25;
            }

            var pickerHeight = 240;
            var frame        = new RectangleF(0, paddingTitle, 269, pickerHeight);
            var pickerView   = new UIPickerView(frame);

            pickerView.Model = new PickerSource(VirtualView);
            pickerView?.ReloadAllComponents();

            var pickerController = UIAlertController.Create(VirtualView.Title, "", UIAlertControllerStyle.ActionSheet);

            // needs translation
            pickerController.AddAction(UIAlertAction.Create("Done",
                                                            UIAlertActionStyle.Default,
                                                            action => FinishSelectItem(pickerView, uITextField)
                                                            ));

            if (pickerController.View != null && pickerView != null)
            {
                pickerController.View.AddSubview(pickerView);
                var doneButtonHeight = 90;
                var height           = NSLayoutConstraint.Create(pickerController.View, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, pickerHeight + doneButtonHeight);
                pickerController.View.AddConstraint(height);
            }

            var popoverPresentation = pickerController.PopoverPresentationController;

            if (popoverPresentation != null)
            {
                popoverPresentation.SourceView = uITextField;
                popoverPresentation.SourceRect = uITextField.Bounds;
            }

            return(pickerController);
        }
Example #26
0
        void ApplyConstraint(UIView superView)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0))
            {
                toastLabel.LeadingAnchor.ConstraintEqualTo(toastContainer.LeadingAnchor, MESSAGE_LABEL_LEFT_RIGHT_PADDING).Active    = true;
                toastLabel.TrailingAnchor.ConstraintEqualTo(toastContainer.TrailingAnchor, -MESSAGE_LABEL_LEFT_RIGHT_PADDING).Active = true;
                toastLabel.TopAnchor.ConstraintEqualTo(toastContainer.TopAnchor, MESSAGE_LABEL_TOP_BOTTOM_PADDING).Active            = true;
                toastLabel.BottomAnchor.ConstraintEqualTo(toastContainer.BottomAnchor, -MESSAGE_LABEL_TOP_BOTTOM_PADDING).Active     = true;

                toastContainer.CenterXAnchor.ConstraintEqualTo(superView.CenterXAnchor).Active = true;
                var toastWidthAnchor = toastContainer.WidthAnchor.ConstraintGreaterThanOrEqualTo(MINIMUN_TOAST_WIDTH);
                toastWidthAnchor.Priority = 999;
                toastWidthAnchor.Active   = true;
                toastContainer.LeadingAnchor.ConstraintGreaterThanOrEqualTo(superView.LeadingAnchor, LEFT_RIGHT_PADDING).Active = true;
                toastContainer.TrailingAnchor.ConstraintLessThanOrEqualTo(superView.TrailingAnchor, -LEFT_RIGHT_PADDING).Active = true;

                if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
                {
                    toastContainer.BottomAnchor.ConstraintEqualTo(superView.SafeAreaLayoutGuide.BottomAnchor, -TOAST_BOTTOM_PADDING).Active = true;
                }
                else
                {
                    toastContainer.BottomAnchor.ConstraintEqualTo(superView.BottomAnchor, -TOAST_BOTTOM_PADDING).Active = true;
                }
            }
            else
            {
                NSLayoutConstraint.Create(toastLabel, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, toastContainer, NSLayoutAttribute.Leading, 1, MESSAGE_LABEL_LEFT_RIGHT_PADDING).Active    = true;
                NSLayoutConstraint.Create(toastLabel, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, toastContainer, NSLayoutAttribute.Trailing, 1, -MESSAGE_LABEL_LEFT_RIGHT_PADDING).Active = true;
                NSLayoutConstraint.Create(toastLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, toastContainer, NSLayoutAttribute.Top, 1, MESSAGE_LABEL_TOP_BOTTOM_PADDING).Active            = true;
                NSLayoutConstraint.Create(toastLabel, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, toastContainer, NSLayoutAttribute.Bottom, 1, -MESSAGE_LABEL_TOP_BOTTOM_PADDING).Active     = true;

                NSLayoutConstraint.Create(toastContainer, NSLayoutAttribute.CenterX, NSLayoutRelation.GreaterThanOrEqual, superView, NSLayoutAttribute.CenterX, 1, 0).Active = true;
                var toastWidthAnchor = NSLayoutConstraint.Create(toastContainer, NSLayoutAttribute.Width, NSLayoutRelation.GreaterThanOrEqual, 1, MINIMUN_TOAST_WIDTH);
                toastWidthAnchor.Priority = 999;
                toastWidthAnchor.Active   = true;

                NSLayoutConstraint.Create(toastContainer, NSLayoutAttribute.Leading, NSLayoutRelation.GreaterThanOrEqual, superView, NSLayoutAttribute.Leading, 1, LEFT_RIGHT_PADDING).Active    = true;
                NSLayoutConstraint.Create(toastContainer, NSLayoutAttribute.Trailing, NSLayoutRelation.GreaterThanOrEqual, superView, NSLayoutAttribute.Trailing, 1, -LEFT_RIGHT_PADDING).Active = true;
                NSLayoutConstraint.Create(toastContainer, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, superView, NSLayoutAttribute.Bottom, 1, -TOAST_BOTTOM_PADDING).Active = true;
            }
        }
Example #27
0
        static NSLayoutConstraint CompileConstraint(BinaryExpression expr, UIView constrainedView)
        {
            var rel = NSLayoutRelation.Equal;

            switch (expr.NodeType)
            {
            case ExpressionType.Equal:
                rel = NSLayoutRelation.Equal;
                break;

            case ExpressionType.LessThanOrEqual:
                rel = NSLayoutRelation.LessThanOrEqual;
                break;

            case ExpressionType.GreaterThanOrEqual:
                rel = NSLayoutRelation.GreaterThanOrEqual;
                break;

            default:
                throw new NotSupportedException("Not a valid relationship for a constrain.");
            }

            var left = GetViewAndAttribute(expr.Left);

            if (left.Item1 != constrainedView)
            {
                left.Item1.TranslatesAutoresizingMaskIntoConstraints = false;
            }

            var right = GetRight(expr.Right);

            if (right.Item1 != null && right.Item1 != constrainedView)
            {
                right.Item1.TranslatesAutoresizingMaskIntoConstraints = false;
            }

            return(NSLayoutConstraint.Create(
                       left.Item1, left.Item2,
                       rel,
                       right.Item1, right.Item2,
                       right.Item3, right.Item4));
        }
Example #28
0
        private static NBMaterialSnackbar CreateSingleWithTextAndDuration(UIView windowView, string text, NBLunchDuration duration)
        {
            NBMaterialSnackbar snack = new NBMaterialSnackbar();

            snack.lunchDuration = duration;
            snack.TranslatesAutoresizingMaskIntoConstraints = false;
            snack.currentHeight = snack.kMinHeight;

            snack.textLabel = new UILabel();
            snack.textLabel.BackgroundColor = UIColor.Clear;
            snack.textLabel.TextAlignment   = UITextAlignment.Left;
            snack.textLabel.Font            = snack.kFontRoboto;
            snack.textLabel.TextColor       = snack.kFontColor;
            snack.textLabel.Lines           = 1;
            snack.textLabel.Alpha           = 0.0f;
            snack.textLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            snack.textLabel.Text = text;

            snack.AddSubview(snack.textLabel);

            windowView.AddSubview(snack);

            snack.constraintViews.SetValueForKey(snack.textLabel, new NSString("textLabel"));
            snack.constraintViews.SetValueForKey(snack, new NSString("snack"));

            snack.constraintMetrics.SetValueForKey(new NSNumber(snack.kVerticalSinglePadding), new NSString("vPad"));
            snack.constraintMetrics.SetValueForKey(new NSNumber(snack.kHorizontalPadding), new NSString("hPad"));
            snack.constraintMetrics.SetValueForKey(new NSNumber(snack.kMinHeight), new NSString("minHeight"));

            snack.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-vPad-[textLabel]-vPad-|",
                                                                     NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics: snack.constraintMetrics,
                                                                     views: snack.constraintViews));
            snack.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-hPad-[textLabel]-hPad-|", NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics: snack.constraintMetrics, views: snack.constraintViews));

            windowView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[snack(==minHeight)]", NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics: snack.constraintMetrics, views: snack.constraintViews));
            windowView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[snack]|", NSLayoutFormatOptions.DirectionLeadingToTrailing, metrics: snack.constraintMetrics, views: snack.constraintViews));

            snack.verticalConstraint = NSLayoutConstraint.Create((NSObject)snack, (NSLayoutAttribute)NSLayoutAttribute.Bottom, (NSLayoutRelation)NSLayoutRelation.Equal, (NSObject)windowView, (NSLayoutAttribute)NSLayoutAttribute.Bottom, (nfloat)1.0, constant: snack.currentHeight);
            windowView.AddConstraint(snack.verticalConstraint);

            return(snack);
        }
Example #29
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            EdgesForExtendedLayout = UIRectEdge.None;
            Chart          = new SFChart();
            CDelegate      = new ChartDelegate();
            Chart.Delegate = CDelegate;

            var sampleFrame = new CGRect(ChartView.Bounds.Location.X,
                                         ChartView.Bounds.GetMinY(),
                                         ChartView.Bounds.Width,
                                         ChartView.Bounds.Height);

            Chart.Frame = sampleFrame;
            Chart.TranslatesAutoresizingMaskIntoConstraints = false;

            View.AddSubview(Chart);

            var horizontalConstraint = NSLayoutConstraint.Create(Chart, NSLayoutAttribute.Top,
                                                                 NSLayoutRelation.Equal,
                                                                 ChartView,
                                                                 NSLayoutAttribute.Top, 1, 0);

            var verticalConstraint = NSLayoutConstraint.Create(Chart,
                                                               NSLayoutAttribute.Bottom,
                                                               NSLayoutRelation.Equal,
                                                               ChartView,
                                                               NSLayoutAttribute.Bottom, 1, 0);
            var widthConstraint = NSLayoutConstraint.Create(Chart,
                                                            NSLayoutAttribute.Width,
                                                            NSLayoutRelation.Equal,
                                                            ChartView, NSLayoutAttribute.Width, 1, 0);
            var heightConstraint = NSLayoutConstraint.Create(Chart,
                                                             NSLayoutAttribute.Height,
                                                             NSLayoutRelation.Equal,
                                                             ChartView,
                                                             NSLayoutAttribute.Height, 1, 0);

            NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { horizontalConstraint, verticalConstraint, widthConstraint, heightConstraint });
            InitializeChartData();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var imageView = new UIImageView();

            imageView.Image = FromUrl(_model.ImageUrl);
            imageView.TranslatesAutoresizingMaskIntoConstraints = false;
//

            View.BackgroundColor = UIColor.White;
            View.Add(imageView);
            View.AddConstraints(new[]
            {
                NSLayoutConstraint.Create(imageView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1f, 20f),
                NSLayoutConstraint.Create(imageView, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1f, 0f),
                NSLayoutConstraint.Create(imageView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1f, 0f),
                NSLayoutConstraint.Create(imageView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, View, NSLayoutAttribute.Height, 1f, 0f)
            });
        }