Example #1
0
        private void LayoutSubviews()
        {
            _hiddenInfo = _info.Height().EqualTo(0f);

            View.AddConstraints(_toggleButton.FullWidthOf(View));
            View.AddConstraints(_mapView.FullWidthOf(View));
            View.AddConstraints(new FluentLayout[]
            {
                _toggleButton.AtBottomOf(View),
                _mapView.AtTopOf(View),
                _mapView.Above(_toggleButton),

                _hiddenInfo,
                _info.AtBottomOf(_toggleButton),
                _info.AtLeftOf(View),
                _info.AtRightOf(View)
            });

            _info.AddConstraints(new FluentLayout[]
            {
                _colon.WithSameCenterX(_info),
                _colon.AtBottomOf(_info, 10f),
                _colon.AtTopOf(_info, 10f),

                _latitude.AtLeftOf(_info, 10f),
                _latitude.ToRightOf(_colon, 10f),
                _latitude.AtBottomOf(_info, 10f),
                _latitude.AtTopOf(_info, 10f),

                _longitude.AtRightOf(_info, 10f),
                _longitude.ToLeftOf(_colon, 10f),
                _longitude.AtBottomOf(_info, 10f),
                _longitude.AtTopOf(_info, 10f),
            });
        }
Example #2
0
        public CommentCell(CGRect frame) : base(frame)
        {
            imageView = new UIImageView();
            imageView.Layer.CornerRadius     = 22;
            imageView.ContentMode            = UIViewContentMode.ScaleAspectFill;
            imageView.Layer.MasksToBounds    = true;
            imageView.UserInteractionEnabled = true;
            imageView.TranslatesAutoresizingMaskIntoConstraints = false;

            commentText = new UITextView();
            commentText.BackgroundColor = UIColor.White;
            commentText.TextColor       = UIColor.FromRGB(90, 89, 89);
            commentText.Selectable      = false;
            commentText.Font            = UIFont.SystemFontOfSize(14);
            commentText.TranslatesAutoresizingMaskIntoConstraints = false;
            commentText.Editable      = false;
            commentText.ScrollEnabled = false;

            likeButton = new UIFeedButton();
            likeButton.SetTitle("Like", UIControlState.Normal);
            likeButton.AddTarget(Self, new ObjCRuntime.Selector("LikeCommentClick:"), UIControlEvent.TouchUpInside);

            nameLabel           = new UILabel();
            nameLabel.TextColor = UIColor.FromRGB(90, 89, 89);
            nameLabel.Font      = UIFont.BoldSystemFontOfSize(14);

            dateLabel           = new UILabel();
            dateLabel.TextColor = UIColor.FromRGB(90, 89, 89);
            dateLabel.Font      = UIFont.SystemFontOfSize(12);

            lineSeparator = new UIView();
            lineSeparator.BackgroundColor = UIColor.FromRGBA(nfloat.Parse("0.88"), nfloat.Parse("0.89"), nfloat.Parse("0.90"), nfloat.Parse("1"));

            ContentView.Add(imageView);
            ContentView.Add(likeButton);
            ContentView.Add(nameLabel);
            ContentView.Add(commentText);
            ContentView.Add(dateLabel);
            ContentView.Add(lineSeparator);

            ContentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            ContentView.AddConstraints(
                imageView.AtLeftOf(ContentView, 8),
                imageView.Width().EqualTo(40),
                imageView.Height().EqualTo(40),
                imageView.AtTopOf(ContentView, 8),

                likeButton.AtRightOf(ContentView, 8),
                likeButton.Width().EqualTo(60),
                likeButton.Height().EqualTo(24),
                likeButton.AtTopOf(ContentView, 4),

                nameLabel.Right().EqualTo().LeftOf(likeButton).Plus(8),
                nameLabel.AtTopOf(ContentView, 8),
                nameLabel.Left().EqualTo().RightOf(imageView).Plus(8),
                nameLabel.Height().EqualTo(20),

                commentText.AtTopOf(ContentView, 28),
                commentText.AtRightOf(ContentView, 8),
                commentText.Left().EqualTo().RightOf(imageView).Plus(3),
                commentText.AtBottomOf(ContentView, 30),

                dateLabel.Below(commentText, 5),
                dateLabel.Height().EqualTo(20),
                dateLabel.AtRightOf(ContentView, 8),
                dateLabel.AtLeftOf(ContentView, 56),
                dateLabel.AtBottomOf(ContentView, 5),

                lineSeparator.AtBottomOf(ContentView, 1),
                lineSeparator.AtRightOf(ContentView, 8),
                lineSeparator.AtLeftOf(ContentView, 8),
                lineSeparator.Height().EqualTo(1)

                );
        }