Exemple #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),
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(248, 191, 120);

            var viewContainer = new UIView {
                BackgroundColor = UIColor.Clear
            };

            var sampleText = new UITextView
            {
                Editable        = false,
                Selectable      = false,
                Text            = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam aliquet massa eu tempus semper. Nulla elementum mi quis erat blandit eleifend. Quisque dictum, sem eget volutpat scelerisque, quam orci lobortis enim, ut luctus enim massa in nisi. Mauris sed mi id leo lacinia lobortis. Integer elementum, erat gravida vestibulum rhoncus, enim velit consectetur est, dignissim condimentum urna turpis ac ex. Nulla arcu mauris, hendrerit nec tortor in, feugiat ullamcorper mauris. Aliquam eget tempus eros. Curabitur suscipit, arcu eu luctus mollis, nunc erat ornare erat, id viverra nisl ligula sit amet ex. Etiam in quam vitae est convallis eleifend. Fusce gravida arcu in orci lobortis pulvinar. Morbi tortor mi, elementum nec purus quis, eleifend imperdiet mi. Nunc commodo et sem vitae finibus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc nec erat eget orci malesuada vulputate. \n \nPhasellus vulputate dolor eu massa varius efficitur. Sed sed tortor eu elit ornare mollis id non sapien. Nam at turpis volutpat ligula aliquam aliquet placerat sed purus. Phasellus magna urna, maximus vitae erat et, malesuada tincidunt velit. Mauris efficitur velit fermentum imperdiet convallis. In eget erat nisi. Curabitur ut leo sodales, consectetur lorem ut, iaculis est. Nullam ornare, justo id condimentum pharetra, enim nisl posuere ex, a fermentum justo enim sit amet dolor. Sed suscipit sapien augue, nec dignissim nisl laoreet eu. Maecenas eros enim, aliquet vitae arcu id, fermentum dignissim lorem. Etiam sit amet commodo nunc. In vitae ullamcorper velit. Integer in mauris eget erat mattis feugiat at id neque.",
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.Clear
            };

            sampleText.TextContainer.LineBreakMode = UILineBreakMode.WordWrap;
            sampleText.Font = UIFont.BoldSystemFontOfSize(18f);

            View.AddSubview(viewContainer);
            viewContainer.AddSubview(sampleText);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            viewContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                viewContainer.AtLeftOf(View),
                viewContainer.AtTopOf(View),
                viewContainer.AtRightOf(View),
                viewContainer.AtBottomOf(View)
                );

            viewContainer.AddConstraints(
                sampleText.AtTopOf(viewContainer),
                // sampleText.AtTopOfSafeArea(viewContainer), -> use this when UINavigationBar not present to avoid content overlap under iPhone X notch
                sampleText.AtLeftOfSafeArea(viewContainer),
                //sampleText.AtLeftOf(viewContainer), -> if this is used, content overlaps under notch on landscape
                sampleText.AtRightOfSafeArea(viewContainer),
                //sampleText.AtRightOf(viewContainer), -> if this is used, content overlaps under notch on landscape
                sampleText.AtBottomOfSafeArea(viewContainer)
                //sampleText.AtBottomOf(viewContainer) -> if this is used, content overlaps under notch on landscape
                );
        }
        protected void InitView()
        {
            this.Hidden  = false;
            sqrRotationA = new RotativeButton()
            {
                BackgroundColor = Color.White.SMooth().ToNative()
            };
            sqrRotationA.SetTitle(((int)ScreenTwoViewModel.Incrementals.SQRA).ToString(), UIControlState.Normal);
            sqrRotationB = new RotativeButton()
            {
                BackgroundColor = Color.White.FResh().ToNative()
            };
            sqrRotationB.SetTitle(((int)ScreenTwoViewModel.Incrementals.SQRB).ToString(), UIControlState.Normal);
            sqrRotationC = new RotativeButton()
            {
                BackgroundColor = Color.White.Micadormissador().ToNative()
            };
            sqrRotationC.SetTitle(((int)ScreenTwoViewModel.Incrementals.SQRC).ToString(), UIControlState.Normal);
            sqrRotationD = new RotativeButton()
            {
                BackgroundColor = Color.White.GIMME().ToNative()
            };
            sqrRotationD.SetTitle(((int)ScreenTwoViewModel.Incrementals.SQRD).ToString(), UIControlState.Normal);

            separator = new UIView()
            {
                BackgroundColor = UIColor.Gray
            };
            informationText = new UITextView()
            {
                Text = "Just tap a box to rotate the adyacents. Each box rotates different. Try to aligne all the boxes, if you can.", TextColor = UIColor.DarkGray, Font = UIFont.FromName("Helvetica", 24), TextAlignment = UITextAlignment.Center, ScrollEnabled = false
            };
            backScreenButton = new NavButton();
            backScreenButton.SetTitle("To previous Screen", UIControlState.Normal);
            backScreenButton.Events().TouchUpInside.Subscribe(_ => this.route.GoToScreenOne());

            this.AddSubview(sqrRotationA);
            this.AddSubview(sqrRotationB);
            this.AddSubview(sqrRotationC);
            this.AddSubview(sqrRotationD);
            this.AddSubview(separator);
            this.AddSubview(informationText);
            this.AddSubview(backScreenButton);

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            var margin = 50;

            this.AddConstraints(

                informationText.AtTopOf(this, margin),
                informationText.AtLeftOf(this, margin),
                informationText.AtRightOf(this, margin),
                informationText.WithRelativeHeight(sqrRotationA, 0.5f),

                sqrRotationA.Below(informationText, margin),
                sqrRotationA.WithRelativeWidth(this, 0.15f),
                sqrRotationA.Height().EqualTo().WidthOf(sqrRotationA),
                sqrRotationA.Right().EqualTo(-margin).CenterXOf(this),

                sqrRotationB.WithSameCenterY(sqrRotationA),
                sqrRotationB.WithSameWidth(sqrRotationA),
                sqrRotationB.WithSameHeight(sqrRotationA),
                sqrRotationB.Left().EqualTo(margin).CenterXOf(this),

                sqrRotationC.Below(sqrRotationA, margin),
                sqrRotationC.WithSameWidth(sqrRotationA),
                sqrRotationC.WithSameHeight(sqrRotationA),
                sqrRotationC.WithSameCenterX(sqrRotationA),

                sqrRotationD.WithSameWidth(sqrRotationA),
                sqrRotationD.WithSameHeight(sqrRotationA),
                sqrRotationD.WithSameCenterX(sqrRotationB),
                sqrRotationD.WithSameCenterY(sqrRotationC),

                separator.Below(sqrRotationC, margin),
                separator.AtLeftOf(this, margin),
                separator.AtRightOf(this, margin),
                separator.Height().EqualTo(3f),

                backScreenButton.Below(separator, margin),
                backScreenButton.WithSameCenterX(this),
                backScreenButton.WithRelativeWidth(this, 0.3f)
                );
        }
Exemple #4
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)

                );
        }
        protected void InitView()
        {
            this.Hidden = false;
            sqrColorA   = new UIButton();
            sqrColorB   = new UIButton();
            sqrColorC   = new UIButton();

            backScreenButton = new NavButton();
            backScreenButton.SetTitle("To previous Screen", UIControlState.Normal);
            backScreenButton.Events().TouchUpInside.Subscribe(_ => this.route.GoToScreenStart());

            separator = new UIView()
            {
                BackgroundColor = UIColor.Gray
            };
            informationText = new UITextView()
            {
                Text = "Just tap on any color box to aleatory change color of other color box.", TextColor = UIColor.DarkGray, Font = UIFont.FromName("Helvetica", 24), TextAlignment = UITextAlignment.Center, ScrollEnabled = false
            };
            nextScreenButton = new NavButton();
            nextScreenButton.SetTitle("To next Screen", UIControlState.Normal);
            nextScreenButton.Events().TouchUpInside.Subscribe(_ => this.route.GoToScreenTwo());

            this.AddSubview(sqrColorA);
            this.AddSubview(sqrColorB);
            this.AddSubview(sqrColorC);
            this.AddSubview(separator);
            this.AddSubview(informationText);
            this.AddSubview(nextScreenButton);
            this.AddSubview(backScreenButton);

            this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            var margin = 50;

            this.AddConstraints(

                informationText.AtTopOf(this, margin),
                informationText.AtLeftOf(this, margin),
                informationText.AtRightOf(this, margin),
                informationText.WithRelativeHeight(sqrColorA, 0.5f),

                sqrColorA.AtTopOf(informationText, margin),
                sqrColorA.WithRelativeWidth(this, 0.2f),
                sqrColorA.Height().EqualTo().WidthOf(sqrColorA),
                sqrColorA.AtLeftOf(this, margin),

                sqrColorB.WithSameCenterY(sqrColorA),
                sqrColorB.WithSameWidth(sqrColorA),
                sqrColorB.WithSameHeight(sqrColorA),
                sqrColorB.WithSameCenterX(this),

                sqrColorC.WithSameCenterY(sqrColorA),
                sqrColorC.WithSameWidth(sqrColorA),
                sqrColorC.WithSameHeight(sqrColorA),
                sqrColorC.AtRightOf(this, margin),

                separator.AtBottomOf(sqrColorB, -margin),
                separator.AtLeftOf(this, margin),
                separator.AtRightOf(this, margin),
                separator.Height().EqualTo(5f),

                nextScreenButton.AtBottomOf(separator, -margin * 3),
                nextScreenButton.WithSameCenterX(this),
                nextScreenButton.WithRelativeWidth(this, 0.2f),

                backScreenButton.Below(nextScreenButton, margin),
                backScreenButton.WithSameCenterX(this),
                backScreenButton.WithRelativeWidth(this, 0.3f)
                );
        }